diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-29 21:02:57 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-29 21:02:57 +0000 |
commit | 6ecbc48d799a39d98a992c0c86e9563bcf4e14f4 (patch) | |
tree | 6395d8c7b9ff0550b8c4bfe67d5c43c982b1116a /TAO/CIAO/CCF/CCF/CodeGenerationKit/Regex.hpp | |
parent | 8e74d5c4835d2697a751d14f34e8fce8dd2bb815 (diff) | |
download | ATCD-6ecbc48d799a39d98a992c0c86e9563bcf4e14f4.tar.gz |
This commit was manufactured by cvs2svn to create branch 'CCF'.
Diffstat (limited to 'TAO/CIAO/CCF/CCF/CodeGenerationKit/Regex.hpp')
-rw-r--r-- | TAO/CIAO/CCF/CCF/CodeGenerationKit/Regex.hpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/TAO/CIAO/CCF/CCF/CodeGenerationKit/Regex.hpp b/TAO/CIAO/CCF/CCF/CodeGenerationKit/Regex.hpp new file mode 100644 index 00000000000..f9928441262 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/CodeGenerationKit/Regex.hpp @@ -0,0 +1,42 @@ +// file : CCF/CodeGenerationKit/Regex.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_RUNTIME_REGEX_HPP +#define CCF_RUNTIME_REGEX_HPP + +#include "MSVC_Pragmas.hpp" + +#include <string> +#include <boost/regex.hpp> + +namespace regex +{ + using boost::regex; + using boost::regex_merge; + + inline std::string + perl_s (std::string src, std::string e) + { + char delimiter = '/'; + + std::string::size_type first = e.find (delimiter); + std::string::size_type middle = e.find (delimiter, first + 1); + std::string::size_type last = e.find (delimiter, middle + 1); + + std::string pattern (e, first + 1, middle - first - 1); + std::string format (e, middle + 1, last - middle - 1); + + //std::cout << pattern << " " << format << std::endl; + + regex expr (pattern); + + return regex_merge ( + src, + expr, + format, + boost::match_default | boost::format_all ); + } +} + +#endif // CCF_RUNTIME_REGEX_HPP |