File: documentlocation.h

package info (click to toggle)
libcitygml 2.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,200 kB
  • sloc: cpp: 8,666; makefile: 15
file content (35 lines) | stat: -rw-r--r-- 823 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include <string>
#include <ostream>
#include <stdint.h>

namespace citygml {

    class DocumentLocation {
    public:
        virtual const std::string& getDocumentFileName() const = 0;
        virtual uint64_t getCurrentLine() const = 0;
        virtual uint64_t getCurrentColumn() const = 0;
    };

    inline std::ostream& operator<<( std::ostream& os, const DocumentLocation& o ) {

        if (o.getCurrentLine() == 0) {
            os << " unknown location";
        } else {
            os << " line " << o.getCurrentLine();

            if (o.getCurrentColumn() > 0) {
                os << ", column " << o.getCurrentColumn();
            }
        }

        if (!o.getDocumentFileName().empty()) {
            os << " in file " << o.getDocumentFileName();
        }

        return os;

    }
}