Changeset 929
- Timestamp:
- 05/25/20 15:23:43 (5 years ago)
- Location:
- cpp/frams
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/sstringutils.h
r904 r929 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 15Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2020 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 28 28 29 29 SString trim(const SString& s); ///< remove leading/trailing whitespace 30 SString concatPath(const SString& in1, const SString& in2); ///< concatenate path components inserting PATH_SEPARATOR_CHAR if not already present30 SString concatPath(const SString& in1, const SString& in2); ///< concatenate path components inserting PATH_SEPARATOR_CHAR if not already present 31 31 bool removeCR(SString& s); ///< remove '\r' return true if changed 32 32 bool matchWildcard(const SString& word, const SString& pattern);///< '*' in pattern matches any substring … … 35 35 bool parseUIDString(const char* str, char prefix, uint64_t &uid, bool err); 36 36 37 // SplitResult can be any class implementing push_back(const SString&), e.g. std::vector<SString> 38 template <class SplitResult> void strSplit(const SString& text, const SString& separator, bool merge_separators, SplitResult& result) 39 { 40 int i, next = 0; 41 bool first = true; 42 if (!separator.len()) { result.push_back(text); return; } 43 while (1) 44 { 45 i = text.indexOf(separator.c_str(), next); 46 if (i < 0) 47 { 48 if ((next <= text.len()) || first) 49 result.push_back(text.substr(next)); 50 return; 51 } 52 if ((!merge_separators) || (i > next) || (i == 0)) 53 { 54 result.push_back(text.substr(next, i - next)); 55 first = false; 56 } 57 next = i + separator.len(); 58 } 59 } 60 61 37 62 #endif -
cpp/frams/vm/classes/collectionobj.h
r868 r929 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 19Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2020 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 20 20 ExtValue *get(int i) { return (ExtValue*)data.get(i); } 21 21 void set_or_insert(int i, const ExtValue& val, bool insert); 22 void push_back(const SString& s) { data += new ExtValue(s); } //for strSplit() 22 23 23 24 static Param par;
Note: See TracChangeset
for help on using the changeset viewer.