Rewrite NTS Framework.
[sim/o1-interface.git] / ntsimulator / regxstring / regxstring.cpp
diff --git a/ntsimulator/regxstring/regxstring.cpp b/ntsimulator/regxstring/regxstring.cpp
new file mode 100644 (file)
index 0000000..a6f1625
--- /dev/null
@@ -0,0 +1,58 @@
+/*************************************************************************\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+***************************************************************************/\r
+\r
+#include "regxstring_impl.h"\r
+#include "regxstring.h"\r
+\r
+CRegxString::CRegxString(const char * regx)\r
+    : impl_(0)\r
+{\r
+    ParseRegx(regx);\r
+}\r
+\r
+CRegxString::~CRegxString()\r
+{\r
+    if(impl_)\r
+        delete impl_;\r
+}\r
+\r
+void CRegxString::ParseRegx(const char * regx,const Config * config)\r
+{\r
+    if(!regx)\r
+        return;\r
+    if(!impl_)\r
+        impl_ = new REGXSTRING_NS::__CRegxString;\r
+    impl_->ParseRegx(regx,config);\r
+}\r
+\r
+const char * CRegxString::Regx() const\r
+{\r
+    return (impl_ ? impl_->Regx().c_str() : 0);\r
+}\r
+\r
+const char * CRegxString::RandString()\r
+{\r
+    return (impl_ ? impl_->RandString().c_str() : 0);\r
+}\r
+const char * CRegxString::LastString() const\r
+{\r
+    return (impl_ ? impl_->LastString().c_str() : 0);\r
+}\r
+\r
+void CRegxString::Debug(std::ostream & out) const\r
+{\r
+    if(impl_)\r
+        impl_->Debug(out);\r
+}\r