rathena/3rdparty/yaml-cpp/src/regex_yaml.cpp
Jittapan Pluemsumran 4a2574c599 Migrate core source files to C++. Add yaml-cpp project as dependency (#2207)
By updating to this commit, Linux users have to regenerate Makefiles by re-running the configure script.

* Added yaml-cpp project as a 3rdparty library
* Migrated source files core to C++
* Updated configure scripts
* Make Linux installations compile *.cpp files
* Made server components' main source file C++
* Also made headers CPP-aware.

* Added basic C wrapper for yaml-cpp library
* YAML-node path is delimited by periods.
* Basic integer types and string are supported.
* Strings returned from this wrapper have to be freed with malloc.h::aFree
* Arrays (sequence) is supported with iterator wrapper.
* Remember to free every wrapper you create!

* Add yaml-cpp as dependency of common project
* Made the repo not ignore *.yml files

Thanks to @aleos89 and @Lemongrass3110.
2017-06-25 23:33:24 +07:00

46 lines
1021 B
C++

#include "regex_yaml.h"
namespace YAML {
// constructors
RegEx::RegEx() : m_op(REGEX_EMPTY) {}
RegEx::RegEx(REGEX_OP op) : m_op(op) {}
RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch) {}
RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z) {}
RegEx::RegEx(const std::string& str, REGEX_OP op) : m_op(op) {
for (std::size_t i = 0; i < str.size(); i++)
m_params.push_back(RegEx(str[i]));
}
// combination constructors
RegEx operator!(const RegEx& ex) {
RegEx ret(REGEX_NOT);
ret.m_params.push_back(ex);
return ret;
}
RegEx operator||(const RegEx& ex1, const RegEx& ex2) {
RegEx ret(REGEX_OR);
ret.m_params.push_back(ex1);
ret.m_params.push_back(ex2);
return ret;
}
RegEx operator&&(const RegEx& ex1, const RegEx& ex2) {
RegEx ret(REGEX_AND);
ret.m_params.push_back(ex1);
ret.m_params.push_back(ex2);
return ret;
}
RegEx operator+(const RegEx& ex1, const RegEx& ex2) {
RegEx ret(REGEX_SEQ);
ret.m_params.push_back(ex1);
ret.m_params.push_back(ex2);
return ret;
}
}