47 default:
return "INCORRECT!";
68 if (
this != &contents) {
165 const string&
key,
const string&
value,
bool ifnokey )
const
169 return find(k->second.begin(), k->second.end(),
value) != k->second.end();
204 const list<string>& lst = k->second;
205 list<string>::const_iterator
i = lst.begin();
206 if (
i != lst.end() && *
i !=
"#") {
210 for (;
i != lst.end(); ++
i) {
218 string::size_type start, end,
done = 0;
219 while ((start =
value.find(
"$(",
done)) != string::npos) {
220 end =
value.find(
")", start);
221 if (end == string::npos) {
223 "Invalid macro definition: " <<
value);
226 string raw_macro =
value.substr(start,end-start+1);
248 copy(k->second.begin(), k->second.end(), back_inserter(values));
253 if (values.empty()) {
265 for ( list<string>::iterator
i = values.begin();
i != values.end(); ++
i) {
266 if (
i->at(0) ==
'-') {
267 list<string>::iterator
plus;
268 while ((
plus = find(
i, values.end(),
i->c_str()+1)) != values.end()) {
279 while ( !values.empty() && values.front().empty()) {
283 return !values.empty();
298 if (skip != 0 && find(skip->begin(), skip->end(), p->first) != skip->end()) {
301 ostr << p->first <<
" = ";
302 ITERATE(list<string>, m, p->second) {
304 ostr <<
'\\' << endl <<
" ";
308 len += m->size() + 1;
341 str->erase(
str->length() -1, 1);
367 size_t eq_pos =
str.find(
"=");
370 string mb_key =
str.substr(0, eq_pos - 1);
371 return mb_key.find_first_of(
"$()") ==
NPOS;
390 if ( strline.empty() || strline.find_first_not_of(
' ') == string::npos ) {
392 m_FileContents->AddReadyKV(m_CurrentKV);
398 m_FileContents->AddReadyKV(m_CurrentKV);
400 AcceptLine(strline.c_str());
405 m_CurrentKV.m_Value += strline;
409 const string include_token(
"include ");
412 strline.substr(include_token.length()));
414 string srcdir_token(
"$(srcdir)");
418 srcdir_token =
"$(top_srcdir)";
424 srcdir_token =
"$(builddir)";
438 LoadInclude(include);
442 m_FileContents->AddReadyKV(m_CurrentKV);
470 m_FileContents->AddReadyKV(m_CurrentKV);
478 if ( kv.
m_Key.empty() )
481 if (kv.
m_Key ==
"CHECK_CMD") {
499 string::size_type start, end;
500 while ((start = v->find(
"${")) != string::npos) {
501 v->replace(start+1, 1, 1,
'(');
503 while ((end = v->find(
"}")) != string::npos) {
504 v->replace( end, 1, 1,
')');
512 size_t start_count=0, end_count=0;
513 ITERATE(list<string>, v, values) {
514 string::size_type start, end;
515 if (!
value.empty()) {
519 for (start=0; (start = v->find(
"$(", start)) != string::npos; ++start)
521 for (end=0; (end = v->find(
")", end)) != string::npos; ++end)
523 if (start_count == end_count) {
526 string first, second;
533 dest.push_back(*
t+arg);
539 dest.push_back(
value);
541 start_count = end_count = 0;
CProjBulderAppException –.
const SProjectTreeInfo & GetProjectTreeInfo(void)
const string & GetBuildRoot(void) const
CSimpleMakeFileContents –.
~CSimpleMakeFileContents(void)
static void LoadFrom(const string &file_path, CSimpleMakeFileContents *fc)
void RemoveDefinition(const string &key)
bool HasDefinition(const string &key) const
void Dump(CNcbiOstream &ostr, const list< string > *skip=0) const
Debug dump.
bool GetPathValue(const string &key, string &value) const
void SetFrom(const CSimpleMakeFileContents &contents)
bool CollectValues(const string &key, list< string > &values, EHowToCollect how) const
bool DoesValueContain(const string &key, const string &value, bool ifnokey=true) const
void AddDefinition(const string &key, const string &value)
const CSimpleMakeFileContents * m_Parent
bool GetValue(const string &key, string &value) const
void AddReadyKV(const SKeyValue &kv)
void Save(const string &filename) const
CSimpleMakeFileContents(void)
static string StripDefine(const string &define)
static bool IsDefine(const string ¶m)
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator end() const
const_iterator find(const key_type &key) const
The NCBI C++ standard methods for dealing with std::string.
std::ofstream out("events_result.xml")
main entry point for tests
string MakeFileTypeAsString(EMakeFileType type)
static bool s_WillContinue(const string &line)
static bool s_IsKVString(const string &str)
static void s_StripContinueStr(string *str)
static bool s_SplitKV(const string &line, SKeyValue &kv)
static bool s_IsCommented(const string &str)
@ eMakeType_ExcludedByReq
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
static string NormalizePath(const string &path, EFollowLinks follow_links=eIgnoreLinks)
Normalize a path.
string GetDir(EIfEmptyPath mode=eIfEmptyPath_Current) const
Get the directory component for this directory entry.
static char GetPathSeparator(void)
Get path separator symbol specific for the current platform.
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CNcbiIstream & NcbiGetlineEOL(CNcbiIstream &is, string &str, string::size_type *count=NULL)
Read from "is" to "str" the next line (taking into account platform specifics of End-of-Line)
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static SIZE_TYPE FindCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case sensitive search.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
#define LIST_SEPARATOR_LIBS
#define LIST_SEPARATOR
Separator for list values in registry.
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
std::istream & in(std::istream &in_, double &x_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
CProjBulderApp & GetApp(void)
access to App singleton
#define PTB_WARNING_EX(file, err_code, msg)
string FilterDefine(const string &define)
void AcceptLine(const string &line)
void LoadInclude(const string &file_path)
string m_Root
Root of the project tree.