GUIDOLib  1.7.7
Guido Engine Internal Documentation
FormatStringParser.h
1 #ifndef __FormatStringParser__
2 #define __FormatStringParser__
3 
4 /*
5  GUIDO Library
6  Copyright (C) 2004 Grame
7 
8 
9  This Source Code Form is subject to the terms of the Mozilla Public
10  License, v. 2.0. If a copy of the MPL was not distributed with this
11  file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 
13  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
14  research@grame.fr
15 
16 */
17 
18 #include <string>
19 #include <vector>
20 
21 class FormatStringParser;
22 
23 typedef std::pair<std::string, int> FormatStringAssoc;
24 typedef std::vector<FormatStringAssoc> FormatStringParserResult;
32 {
33  public:
34  enum type { kLitteral, kSpecial };
36  virtual ~FormatStringParser() {}
37 
38  virtual void parse( const char * str, FormatStringParserResult& res);
39 
40  protected:
41  virtual char getSpecialStart() const { return '['; }
42  virtual char getSpecialEnd() const { return ']'; }
43  virtual char getEscapeChar() const { return '\\'; }
44  virtual void store (std::string str, type t, FormatStringParserResult& res) const;
45  virtual void switchTo (type t);
46 
47  private:
48  std::string mCurrString;
49  type mCurrType;
50 };
51 
52 #endif
FormatStringParser::store
virtual void store(std::string str, type t, FormatStringParserResult &res) const
FormatStringParser::type
type
Definition: FormatStringParser.h:34
FormatStringParser::parse
virtual void parse(const char *str, FormatStringParserResult &res)
FormatStringParser::getSpecialEnd
virtual char getSpecialEnd() const
Definition: FormatStringParser.h:42
FormatStringParser::getSpecialStart
virtual char getSpecialStart() const
Definition: FormatStringParser.h:41
FormatStringParser::kSpecial
Definition: FormatStringParser.h:34
FormatStringParser
Definition: FormatStringParser.h:31
FormatStringParser::getEscapeChar
virtual char getEscapeChar() const
Definition: FormatStringParser.h:43
FormatStringParser::FormatStringParser
FormatStringParser()
Definition: FormatStringParser.h:35
FormatStringParser::switchTo
virtual void switchTo(type t)
FormatStringParser::kLitteral
Definition: FormatStringParser.h:34
FormatStringParser::~FormatStringParser
virtual ~FormatStringParser()
Definition: FormatStringParser.h:36

Guido Project Copyright © 2019 Grame-CNCM