NCBI C++ ToolKit
text_ostream.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS_FORMAT___TEXT_OSTREAM_HPP
2 #define OBJTOOLS_FORMAT___TEXT_OSTREAM_HPP
3 
4 /* $Id: text_ostream.hpp 100571 2023-08-11 13:06:42Z gotvyans $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Aaron Ucko, NCBI
30 * Mati Shomrat
31 *
32 * File Description:
33 * Output streams interface for formatted items.
34 *
35 */
36 #include <corelib/ncbistd.hpp>
37 #include <corelib/ncbiobj.hpp>
38 #include <serial/serialbase.hpp>
39 
40 
43 
44 
45 class IFlatItem;
46 
47 
48 /////////////////////////////////////////////////////////////////////////////
49 //
50 // TextOStream
51 
52 class IFlatTextOStream : public CObject
53 {
54 public:
55 
56  enum EAddNewline {
59  };
60 
61  // TODO: for SC-9, make this pure virtual
62  /** This adds a list of strings to the stream one at a time, unconditionally adding a newline to each one. */
63  virtual void AddParagraph(const list<string>& /*text*/,
64  const CSerialObject* /*obj*/ = nullptr)
65  {
66  // must be overridden
67  _TROUBLE;
68  }
69 
70  // TODO: for SC-9, make this pure virtual
71  /** This adds its given argument, appending a newline only if the add_newline argument is eAddNewline_Yes. */
72  virtual void AddLine( const CTempString& /*line*/,
73  const CSerialObject* /*obj*/ = nullptr,
74  EAddNewline /*add_newline*/ = eAddNewline_Yes )
75  {
76  // must be overridden
77  _TROUBLE;
78  }
79 
80  virtual void Flush(void) {}
81 
82  virtual ~IFlatTextOStream(void) {}
83 };
84 
85 
88 
89 #endif /* OBJTOOLS_FORMAT___TEXT_OSTREAM_HPP */
CObject –.
Definition: ncbiobj.hpp:180
Base class for all serializable objects.
Definition: serialbase.hpp:150
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
virtual void AddLine(const CTempString &, const CSerialObject *=nullptr, EAddNewline=eAddNewline_Yes)
This adds its given argument, appending a newline only if the add_newline argument is eAddNewline_Yes...
virtual void AddParagraph(const list< string > &, const CSerialObject *=nullptr)
This adds a list of strings to the stream one at a time, unconditionally adding a newline to each one...
virtual ~IFlatTextOStream(void)
virtual void Flush(void)
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
#define _TROUBLE
Modified on Tue Jul 23 17:49:22 2024 by modify_doxy.py rev. 669887