diff --git a/src/ezc.cpp b/src/ezc.cpp index e55318b..84d0be1 100644 --- a/src/ezc.cpp +++ b/src/ezc.cpp @@ -118,6 +118,14 @@ void SplitUnixDirectory(const std::string & name, std::string & dir, std::string * */ + +Pattern::Pattern() +{ + allow_include = true; +} + + + void Pattern::ParseFile(const std::string & file_name) { ParseFile( file_name.c_str() ); @@ -141,6 +149,21 @@ std::string file; } + +void Pattern::ParseString(const std::string & str) +{ + itext = str.c_str(); + CreateTree(item_root); +} + + +void Pattern::ParseString(const char * str) +{ + itext = str; + CreateTree(item_root); +} + + void Pattern::Directory(const char * d) { directory = d; @@ -524,7 +547,7 @@ return false; void Pattern::CreateTreeReadInclude(Item & item) { - if( item.directives.empty() || item.directives[0].empty() || item.directives[0][0]!='\"' ) + if( !allow_include || item.directives.empty() || item.directives[0].empty() || item.directives[0][0]!='\"' ) return; std::string file_text = ReadFile( item.directives[0].c_str()+1 ); diff --git a/src/ezc.h b/src/ezc.h index bb6c35d..4809228 100644 --- a/src/ezc.h +++ b/src/ezc.h @@ -68,8 +68,12 @@ void SplitUnixDirectory(const std::string & name, std::string & dir, std::string class Pattern { public: + Pattern(); + void ParseFile(const std::string & file_name); void ParseFile(const char * file_name); + void ParseString(const std::string & str); + void ParseString(const char * str); void Directory(const char * d); void Directory(const std::string & d); @@ -107,6 +111,8 @@ public: Item item_root; + bool allow_include; + private: const char * itext; std::string directory;