summaryrefslogtreecommitdiff
path: root/src/mg_decoration.h
Commit message (Expand)AuthorAge
* Clean up threadingShadowNinja2015-08-23
* Split ObjDef/ObjDefManager out to objdef.cppkwolekr2015-05-18
* Schematics: Remove referenced schematics from Decorations on clearkwolekr2015-04-17
* Schematics: Refactor NodeResolver and add NodeResolveMethodkwolekr2015-04-16
* ObjDefManager, Mapgen SAPI: Huge refactoringkwolekr2015-03-31
* GenElementManager: Pass opaque handles to Lua and rename to ObjDefManagerkwolekr2015-03-31
* mg_decoration: Raise highest allowed deco top to max edge of voxelmanipparamat2015-03-15
* Biome API: Enable decorations placed on waterparamat2015-03-06
* Shorten ManualMapVoxelManipulator to MMVManipkwolekr2015-01-05
* Add minetest.generate_ores() and minetest.generate_decorations()kwolekr2015-01-04
* Replace instances of height_min/height_max with y_min/y_max to remove ambiguitykwolekr2014-12-30
* Decoration: Add height_min and height_max parameterskwolekr2014-12-28
* Redefine NodeResolver interface and replace with callback mechanismkwolekr2014-12-27
* Add minetest.clear_registered_decorations() and clear_registered_ores()kwolekr2014-12-12
* Remove get_noiseparams function. read_noiseparams should be used from now onkwolekr2014-12-10
* Fix struct vs. class in forward declarationsKahrl2014-12-08
* Rewrite generate notification mechanismkwolekr2014-12-06
* Add Generator Element Management frameworkkwolekr2014-11-12
* Split up mapgen.cppkwolekr2014-11-01
SS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef STRFND_HEADER #define STRFND_HEADER #include <string> std::string trim(const std::string &str); class Strfnd{ std::string tek; unsigned int p; public: void start(std::string niinq){ tek = niinq; p=0; } unsigned int where(){ return p; } void to(unsigned int i){ p = i; } std::string what(){ return tek; } std::string next(std::string plop){ //std::cout<<"tek=\""<<tek<<"\" plop=\""<<plop<<"\""<<std::endl; size_t n; std::string palautus; if (p < tek.size()) { //std::cout<<"\tp<tek.size()"<<std::endl; if ((n = tek.find(plop, p)) == std::string::npos || plop == "") { //std::cout<<"\t\tn == string::npos || plop == \"\""<<std::endl; n = tek.size(); } else { //std::cout<<"\t\tn != string::npos"<<std::endl; } palautus = tek.substr(p, n-p); p = n + plop.length(); } //else //std::cout<<"\tp>=tek.size()"<<std::endl; //std::cout<<"palautus=\""<<palautus<<"\""<<std::endl; return palautus; } bool atend(){ if(p>=tek.size()) return true; return false; } Strfnd(std::string s){ start(s); } }; class WStrfnd{ std::wstring tek; unsigned int p; public: void start(std::wstring niinq){ tek = niinq; p=0; } unsigned int where(){ return p; } void to(unsigned int i){ p = i; } std::wstring what(){ return tek; } std::wstring next(std::wstring plop){ //std::cout<<"tek=\""<<tek<<"\" plop=\""<<plop<<"\""<<std::endl; size_t n; std::wstring palautus; if (p < tek.size()) { //std::cout<<"\tp<tek.size()"<<std::endl; if ((n = tek.find(plop, p)) == std::wstring::npos || plop == L"") { //std::cout<<"\t\tn == string::npos || plop == \"\""<<std::endl; n = tek.size(); } else { //std::cout<<"\t\tn != string::npos"<<std::endl; } palautus = tek.substr(p, n-p); p = n + plop.length(); } //else //std::cout<<"\tp>=tek.size()"<<std::endl; //std::cout<<"palautus=\""<<palautus<<"\""<<std::endl; return palautus; } bool atend(){ if(p>=tek.size()) return true; return false; } WStrfnd(std::wstring s){ start(s); } }; inline std::string trim(const std::string &s) { std::string str = s; while( str.length()>0 && ( str.substr(0, 1)==" " || str.substr(0, 1)=="\t" || str.substr(0, 1)=="\r" || str.substr(0, 1)=="\n" || str.substr(str.length()-1, 1)==" " || str.substr(str.length()-1, 1)=="\t" || str.substr(str.length()-1, 1)=="\r" || str.substr(str.length()-1, 1)=="\n" ) ) { if (str.substr(0, 1)==" ") str = str.substr(1,str.length()-1); else if (str.substr(0, 1)=="\t") str = str.substr(1,str.length()-1); else if (str.substr(0, 1)=="\r") str = str.substr(1,str.length()-1); else if (str.substr(0, 1)=="\n") str = str.substr(1,str.length()-1); else if (str.substr(str.length()-1, 1)==" ") str = str.substr(0,str.length()-1); else if (str.substr(str.length()-1, 1)=="\t") str = str.substr(0,str.length()-1); else if (str.substr(str.length()-1, 1)=="\r") str = str.substr(0,str.length()-1); else if (str.substr(str.length()-1, 1)=="\n") str = str.substr(0,str.length()-1); } return str; } #endif