NCBI C++ ToolKit
calc_nbpos_stream.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: calc_nbpos_stream.cpp 19853 2009-08-13 18:27:23Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Roman Katargin
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
37 
39  m_Row(0), m_CurrentLineLength(0),
40  m_NB(false), m_NBStartChar(0), m_NBEndChar(0), m_NBRow(0)
41 {
42 }
43 
45 {
46  ++m_Row;
48 
49  if (m_NB) {
50  m_NB = false;
52  }
53 }
54 
56 {
57  if (m_NB) {
58  m_NB = false;
60  }
61  else {
62  m_NB = true;
63  m_NBRow = m_Row;
65  }
66 }
67 
69 {
70  m_CurrentLineLength += text.length();
71  return *this;
72 }
73 
74 void CCalcNBPosOStream::Indent (size_t steps)
75 {
76  m_CurrentLineLength += steps;
77 }
78 
80 {
81  return m_CurrentLineLength;
82 }
83 
84 void CCalcNBPosOStream::GetNBPos(int& start, int& end, int& row) const
85 {
86  if (m_NBStartChar == m_NBEndChar) {
87  start = m_CurrentLineLength;
88  end = m_CurrentLineLength;
89  row = m_Row;
90  }
91  else {
92  start = m_NBStartChar;
93  end = m_NBEndChar;
94  row = m_NBRow;
95  }
96 }
97 
virtual void Indent(size_t steps)
virtual void NewLine()
virtual int CurrentRowLength() const
void GetNBPos(int &start, int &end, int &row) const
virtual void NBtoggle()
virtual CStyledTextOStream & operator<<(const string &text)
#define false
Definition: bool.h:36
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static void text(MDB_val *v)
Definition: mdb_dump.c:62
#define row(bind, expected)
Definition: string_bind.c:73
Modified on Sun May 19 04:42:34 2024 by modify_doxy.py rev. 669887