strusAnalyzer  0.17
patternMatcherResultItem.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_ANALYZER_PATTERN_MATCHER_RESULT_ITEM_HPP_INCLUDED
11 #define _STRUS_ANALYZER_PATTERN_MATCHER_RESULT_ITEM_HPP_INCLUDED
13 #include "strus/base/stdint.h"
14 
15 namespace strus {
16 namespace analyzer {
17 
20 {
21 public:
24  :m_name(0),m_value(0),m_ordpos(0),m_ordend(0),m_origpos(),m_origend(){}
26  PatternMatcherResultItem( const char* name_, const char* value_, int ordpos_, int ordend_, const Position& origpos_, const Position& origend_)
27  :m_name(name_),m_value(value_),m_ordpos(ordpos_),m_ordend(ordend_),m_origpos(origpos_),m_origend(origend_){}
29 #if __cplusplus >= 201103L
32  PatternMatcherResultItem& operator= ( PatternMatcherResultItem&& ) = default;
33  PatternMatcherResultItem& operator= ( const PatternMatcherResultItem& ) = default;
34 #else
36  :m_name(o.m_name),m_value(o.m_value),m_ordpos(o.m_ordpos),m_ordend(o.m_ordend),m_origpos(o.m_origpos),m_origend(o.m_origend){}
37 #endif
40 
42  const char* name() const {return m_name;}
45  const char* value() const {return m_value;}
47  int ordpos() const {return m_ordpos;}
49  int ordend() const {return m_ordend;}
51  const Position& origpos() const {return m_origpos;}
53  const Position& origend() const {return m_origend;}
54 
55 private:
56  const char* m_name;
57  const char* m_value;
58  uint32_t m_ordpos;
59  uint32_t m_ordend;
60  Position m_origpos;
61  Position m_origend;
62 };
63 
64 
65 }} //namespace
66 #endif
67 
const char * value() const
Pointer to value of the item.
Definition: patternMatcherResultItem.hpp:45
PatternMatcherResultItem(const char *name_, const char *value_, int ordpos_, int ordend_, const Position &origpos_, const Position &origend_)
Constructor.
Definition: patternMatcherResultItem.hpp:26
const Position & origend() const
End of the result item in the original source (first byte after the item)
Definition: patternMatcherResultItem.hpp:53
const char * name() const
Name of the item, defined by the variable assigned to the match.
Definition: patternMatcherResultItem.hpp:42
int ordend() const
Ordinal (counting) end position of the match.
Definition: patternMatcherResultItem.hpp:49
PatternMatcherResultItem()
Default constructor.
Definition: patternMatcherResultItem.hpp:23
int ordpos() const
Ordinal (counting) position of the match (resp. the first term of the match)
Definition: patternMatcherResultItem.hpp:47
~PatternMatcherResultItem()
Destructor.
Definition: patternMatcherResultItem.hpp:39
Result item structure of a pattern match result.
Definition: patternMatcherResultItem.hpp:19
const Position & origpos() const
Start of the result item in the original source.
Definition: patternMatcherResultItem.hpp:51
PatternMatcherResultItem(const PatternMatcherResultItem &o)
Copy constructor.
Definition: patternMatcherResultItem.hpp:35
Structure describing a position in a document source by segment and offset.
Structure describing a position in a document source by segment and offset.
Definition: position.hpp:22