Utilities to manipulate text files.
More...
#include <OGF/basic/common/common.h>
#include <string>
#include <vector>
#include <map>
#include <iostream>
Go to the source code of this file.
|
| OGF |
| Global Graphite namespace.
|
|
Utilities to manipulate text files.
Definition in file text_utils.h.
◆ concatenate()
void OGF::TextUtils::concatenate |
( |
std::istream & |
in, |
|
|
std::ostream & |
out |
|
) |
| |
Copies the content of an input stream to an output stream.
- Parameters
-
[in] | in | the input stream |
[out] | out | the output stream |
◆ file_contains_string()
bool OGF::TextUtils::file_contains_string |
( |
const std::string & |
file_name, |
|
|
const std::string & |
x |
|
) |
| |
Tests whether a file contains an occurence of a string.
- Parameters
-
file_name | name of the file |
x | the string |
- Return values
-
true | if file file_name contains at least an occurence of string x . |
false | otherwise |
◆ find_and_replace()
void OGF::TextUtils::find_and_replace |
( |
std::istream & |
in, |
|
|
std::ostream & |
out, |
|
|
const Environment & |
env |
|
) |
| |
Performs variables substitution in a stream.
Whenever varname% is encountered in the input stream, if a variable named "varname" exists in the environment, then the string is replaced with its contents, else it is kept as is.
- Parameters
-
[in] | in | the input stream |
[out] | out | the output stream |
[in] | env | a const reference to the environment |
◆ operator<<()
std::ostream& OGF::TextUtils::operator<< |
( |
std::ostream & |
out, |
|
|
const Environment & |
env |
|
) |
| |
|
inline |
Outputs the contents of an Enviroment to a stream.
- Parameters
-
[in,out] | out | the stream where the contents of the Environment should be output |
[in] | env | a const reference to the Environment |
- Returns
- the new state of the stream
Definition at line 165 of file text_utils.h.
◆ read_environment_file()
void OGF::TextUtils::read_environment_file |
( |
const std::string & |
file_name, |
|
|
Environment & |
environment |
|
) |
| |
Reads an Environment from a file.
- Parameters
-
[in] | file_name | name of the file |
[out] | environment | where to read the file |