27 #if !defined(MYSQLPP_SSX_PARSEV2_H)    28 #define MYSQLPP_SSX_PARSEV2_H    30 #include <exceptions.h>    62         File(
const char* file_name);
    65         void error(
const std::string& msg) 
const;
    68         void error(
const std::ostringstream& msg)
 const    72         const char* 
name()
 const { 
return file_name_.c_str(); }
    92         bool read_line(std::string& line, 
bool& subdirective);
   104         void add_directory_to_search_path(
const char* filepath);
   108         void split_path(
StringList& parts, 
const std::string& path) 
const;
   116         std::string file_name_;
   157         virtual void print(std::ostream& os) 
const = 0;
   192         Field(
const std::string& name, 
const std::string& type,
   193                 bool is_unsigned = 
false, 
bool is_null = 
false,
   194                 bool is_autoinc = 
false, 
bool is_key = 
false,
   195                 const std::string& alias = 0) :
   198         is_autoinc_(is_autoinc),
   201         is_unsigned_(is_unsigned),
   218         void print(std::ostream& os) 
const;
   266             Type(
const std::string& s);
   276             void print(std::ostream& os) 
const;
   279             operator Value()
 const { 
return value_; }
   283                     { 
return value_ == rhs.value_; }
   339         void print(std::ostream&)
 const { assert(0); }
   395         const char* 
value()
 const { 
return value_.c_str(); }
   415         void print(std::ostream& os) 
const;
   435         static Type parse_type(
const std::string& style,
   455         operator bool()
 const { 
return throw_; }
   459         void print(std::ostream& os) 
const;
   480         void print(std::ostream& os) 
const;
   499         void print(std::ostream& os) 
const;
   512         Table(
const std::string& name, 
const std::string& alias,
   513                 const std::string& filebase);
   527         void print(std::ostream& os) 
const;
   530         std::string name_, alias_, filebase_;
   567         const char* 
file_name()
 const { 
return file_name_.c_str(); }
   570         size_t line()
 const { 
return line_; }
   573         std::string file_name_;
   588     ParseV2(
const char* file_name);
   593         for (
LineListIt it = lines_.begin(); it != lines_.end(); ++it) {
   612     void tokenize(
StringList& tokens, 
const std::string& line) 
const;
   635 std::ostream& operator<<(std::ostream& os, 
const ParseV2::Line& line);
   637 #endif // !defined(MYSQLPP_SSX_PARSEV2_H) 
SET. 
Definition: parsev2.h:257
LineListIt end() const
Get an iterator pointing just past the end of our LineList. 
Definition: parsev2.h:608
Value
Known SQL field types. 
Definition: parsev2.h:245
virtual ~Option()
Virtual dtor, since this is a base class. 
Definition: parsev2.h:355
Field(const std::string &name, const std::string &type, bool is_unsigned=false, bool is_null=false, bool is_autoinc=false, bool is_key=false, const std::string &alias=0)
Holds information about a SQL field declared in the SSQLS v2 language. 
Definition: parsev2.h:192
FLOAT, FLOAT4, FLOAT8. 
Definition: parsev2.h:250
'option implementation_extension' directive line 
Definition: parsev2.h:484
const char * name() const
Return the file's name. 
Definition: parsev2.h:72
'option exception_on_schema_mismatch' directive line 
Definition: parsev2.h:443
'include' directive line 
Definition: parsev2.h:300
AccessorStyleOption(const std::string &value, const File &file)
Constructor. 
Definition: parsev2.h:407
TIME. 
Definition: parsev2.h:256
A smart enum for converting SQL type strings to one of a relatively few types we directly support...
Definition: parsev2.h:229
Exception object thrown by File::error() to report an SSQLS v2 parsing error. 
Definition: parsev2.h:547
Type(const std::string &s)
Constructor. 
Definition: parsev2.cpp:251
const char * file_name() const
Get name of file where error occurred. 
Definition: parsev2.h:567
LineListIt end() const
Get an iterator pointing to just past the end of the sub-parse's LineList. 
Definition: parsev2.h:322
~Include()
Destructor. 
Definition: parsev2.h:314
const char * extension() const
Return the extension used for C++ implementation files we emit. 
Definition: parsev2.h:495
LineListIt begin() const
Get an iterator pointing to the start of the. 
Definition: parsev2.h:318
static Line * parse(const StringList &tl, bool subdirective, const File &file)
Virtual ctor, creating one of our subclass objects based on what we're passed. 
Definition: parsev2.cpp:485
virtual ~Line()
Virtual dtor, since this is a base class. 
Definition: parsev2.h:140
static bool parse_bool(const std::string &value)
Convert a string expressing a boolean value to a bool. 
Definition: parsev2.cpp:575
std::vector< Line * > LineList
A list of pointers to Line objects. 
Definition: parsev2.h:167
void print(std::ostream &os) const
Print type description out to a stream in SSQLS v2 form. 
Definition: parsev2.cpp:305
Exception object thrown to indicate a file I/O error. 
Definition: parsev2.h:535
bool operator==(const Type &rhs) const
Equality operator. 
Definition: parsev2.h:282
ExceptionOnSchemaMismatchOption(const std::string &value)
Constructor. 
Definition: parsev2.h:447
Base class for parsed SSQLS v2 declaration lines. 
Definition: parsev2.h:136
'option accessor_style' directive line 
Definition: parsev2.h:403
void print(std::ostream &os) const
Print the option description out to a stream in SSQLS v2 form. 
Definition: parsev2.cpp:459
'field' directive line 
Definition: parsev2.h:176
void parse_error(const std::ostringstream &msg) const
Definition: parsev2.h:79
static Option * parse(const StringList &tl, bool subdirective, const File &file)
Attempt to create an Option object from information in the passed StringList. 
Definition: parsev2.cpp:536
Type(Value v)
Copy constructor. 
Definition: parsev2.h:269
Include(const char *file_name)
Given the name of another SSQLS v2 file, load it up and parse it. Its contents will appear transparen...
Definition: parsev2.h:308
~ParseV2()
Destructor. 
Definition: parsev2.h:591
~ParseException()
Destructor. 
Definition: parsev2.h:564
void error(const std::ostringstream &msg) const
Definition: parsev2.h:68
void print(std::ostream &os) const
Print the option description out to a stream in SSQLS v2 form. 
Definition: parsev2.cpp:122
FileException(const std::string &what)
Constructor. 
Definition: parsev2.h:542
DOUBLE, DECIMAL, FIXED, NUMERIC. 
Definition: parsev2.h:251
INT, MEDIUMINT, INT3, INT4. 
Definition: parsev2.h:248
static Include * parse(const StringList &tl, bool subdirective, const File &file)
Attempt to create an Include object from information in the passed StringList. 
Definition: parsev2.cpp:466
Line()
Protected ctor, to prevent instantiation. 
Definition: parsev2.h:161
void parse_error(const std::string &msg) const
Throw a ParseException containing the given message and our stored info about the file name and curre...
Definition: parsev2.cpp:399
const char * value() const
Return the option's value in string form, unmodified from the original parse. 
Definition: parsev2.h:395
Parses SSQLS v2 documents and holds the parse result. 
Definition: parsev2.h:41
static Table * parse(const StringList &tl, bool subdirective, const File &file)
Attempt to create a Table object from information in the passed StringList. 
Definition: parsev2.cpp:605
LineListIt begin() const
Get an iterator pointing to the start of our LineList. 
Definition: parsev2.h:599
Holds information about an SSQLS v2 file we're parsing. 
Definition: parsev2.h:57
BIGINT, INT8. 
Definition: parsev2.h:249
ParseException(const std::string &what, const std::string &file_name, size_t line)
Constructor. 
Definition: parsev2.h:555
Base class for known SSQLS v2 'option' directives. 
Definition: parsev2.h:351
ParseV2(const char *file_name)
Constructor. 
Definition: parsev2.cpp:52
std::vector< std::string > StringList
List of tokens as returned by boost::algorithm::split. 
Definition: parsev2.h:45
StringList::const_iterator StringListIt
Iterator into a StringList. 
Definition: parsev2.h:50
SMALLINT, INT2. 
Definition: parsev2.h:247
DATE. 
Definition: parsev2.h:254
void error(const std::string &msg) const
Throw a FileException containing the given message. 
Definition: parsev2.cpp:392
static Field * parse(const StringList &tl, bool subdirective, const File &file)
Attempt to create a Field object from information in the passed StringList. 
Definition: parsev2.cpp:170
virtual void print(std::ostream &os) const =0
Print line's contents out to a stream in SSQLS v2 form. 
void print(std::ostream &os) const
Print the option description out to a stream in SSQLS v2 form. 
Definition: parsev2.cpp:162
TINYINT, INT1, BOOL. 
Definition: parsev2.h:246
void clear()
Dump our line list. 
Definition: parsev2.h:605
size_t line() const
Get line number where error occurred. 
Definition: parsev2.h:570
*CHAR, ENUM, *TEXT 
Definition: parsev2.h:252
bool read_line(std::string &line, bool &subdirective)
Read a line in from a file. 
Definition: parsev2.cpp:406
LineList::const_iterator LineListIt
Iterator into a LineList. 
Definition: parsev2.h:173
File(const char *file_name)
Open a file for reading, using the search path to file the file if the direct path isn't readable...
Definition: parsev2.cpp:325
'table' directive line 
Definition: parsev2.h:503
Option(const std::string &value)
Protected ctor, so we cannot be directly instantiated. 
Definition: parsev2.h:371
void print(std::ostream &os) const
Print field description out to a stream in SSQLS v2 form. 
Definition: parsev2.cpp:239
ImplementationExtensionOption(const std::string &value)
Constructor. 
Definition: parsev2.h:488
void print(std::ostream &os) const
Print the table description out to a stream in SSQLS v2 form. 
Definition: parsev2.cpp:645
DATETIME, TIMESTAMP. 
Definition: parsev2.h:255
Table(const std::string &name, const std::string &alias, const std::string &filebase)
Constructor. 
Definition: parsev2.cpp:595
*BLOB, VARBINARY 
Definition: parsev2.h:253