App/Toponaming: Add supporting code

Support for reading and writing binary data, and a small tweak to bitmask.
This commit is contained in:
Chris Hennes
2023-03-30 21:19:58 -05:00
committed by Chris Hennes
parent d9e171e5d0
commit 1c0cf32b22
5 changed files with 195 additions and 0 deletions

View File

@@ -72,6 +72,8 @@ public:
void insertAsciiFile(const char* FileName);
/// insert a binary file BASE64 coded as CDATA section in the XML file
void insertBinFile(const char* FileName);
/// insert text string as CDATA
void insertText(const std::string &s);
/** @name additional file writing */
//@{
@@ -115,6 +117,23 @@ public:
virtual std::ostream &Stream()=0;
/** Create an output stream for storing character content
* The input is assumed to be valid character with
* the current XML encoding, and will be enclosed inside
* CDATA section. The stream will scan the input and
* properly escape any CDATA ending inside.
* @return Returns an output stream.
*
* You must call endCharStream() to end the current character stream.
*/
std::ostream &beginCharStream();
/** End the current character output stream
* @return Returns the normal writer stream for convenience
*/
std::ostream &endCharStream();
/// Return the current character output stream
std::ostream &charStream();
/// name for underlying file saves
std::string ObjectName;
@@ -138,6 +157,8 @@ protected:
private:
Writer(const Writer&);
Writer& operator=(const Writer&);
std::unique_ptr<std::ostream> CharStream;
};