Skip to content

Commit 71a7916

Browse files
committed
added TokenList constructor which takes a std::string
1 parent 2f9038c commit 71a7916

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

simplecpp.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,13 @@ simplecpp::TokenList::TokenList(std::istream &istr, std::vector<std::string> &fi
476476
readfile(stream,filename,outputList);
477477
}
478478

479+
simplecpp::TokenList::TokenList(const std::string &str, std::vector<std::string> &filenames, const std::string &filename, OutputList *outputList)
480+
: frontToken(nullptr), backToken(nullptr), files(filenames)
481+
{
482+
StdStringStream stream(str);
483+
readfile(stream,filename,outputList);
484+
}
485+
479486
simplecpp::TokenList::TokenList(const std::string &filename, std::vector<std::string> &filenames, OutputList *outputList)
480487
: frontToken(nullptr), backToken(nullptr), files(filenames)
481488
{

simplecpp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ namespace simplecpp {
198198
explicit TokenList(std::vector<std::string> &filenames);
199199
/** generates a token list from the given std::istream parameter */
200200
TokenList(std::istream &istr, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = nullptr);
201+
/** generates a token list from the given std::string parameter */
202+
TokenList(const std::string &str, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = nullptr);
201203
/** generates a token list from the given filename parameter */
202204
TokenList(const std::string &filename, std::vector<std::string> &filenames, OutputList *outputList = nullptr);
203205
TokenList(const TokenList &other);

0 commit comments

Comments
 (0)