Current Version: 1.0.10
Project Name: csspp
position.cpp
Go to the documentation of this file.
1 // CSS Preprocessor
2 // Copyright (C) 2015-2016 Made to Order Software Corp.
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 
18 #include "csspp/position.h"
19 
20 namespace csspp
21 {
22 
23 position::position(std::string const & filename, line_t page, line_t line)
24  : f_filename(filename)
25  , f_page(page)
26  , f_line(line)
27  , f_total_line(line)
28 {
29 }
30 
32 {
33  if(this != &rhs)
34  {
35  f_filename = rhs.f_filename;
36  f_page = rhs.f_page;
37  f_line = rhs.f_line;
39  }
40 
41  return *this;
42 }
43 
45 {
46  ++f_line;
47  ++f_total_line;
48 }
49 
51 {
52  ++f_page;
53  f_line = 1;
54 }
55 
56 std::string const & position::get_filename() const
57 {
58  return f_filename;
59 }
60 
62 {
63  return f_page;
64 }
65 
67 {
68  return f_line;
69 }
70 
72 {
73  return f_total_line;
74 }
75 
76 } // namespace csspp
77 
78 // Local Variables:
79 // mode: cpp
80 // indent-tabs-mode: nil
81 // c-basic-offset: 4
82 // tab-width: 4
83 // End:
84 
85 // vim: ts=4 sw=4 et
line_t get_page() const
Definition: position.cpp:61
void next_line()
Definition: position.cpp:44
std::string const & get_filename() const
Definition: position.cpp:56
line_t f_total_line
Definition: position.h:49
int line_t
Definition: position.h:27
line_t get_total_line() const
Definition: position.cpp:71
position(std::string const &filename, line_t page=1, line_t line=1)
Definition: position.cpp:23
line_t f_line
Definition: position.h:48
line_t f_page
Definition: position.h:47
position & operator=(position const &rhs)
Definition: position.cpp:31
std::string f_filename
Definition: position.h:46
line_t get_line() const
Definition: position.cpp:66
void next_page()
Definition: position.cpp:50

Documentation of CSS Preprocessor.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.