strusAnalyzer  0.17
documentClass.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 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_DOCUMENT_CLASS_HPP_INCLUDED
11 #define _STRUS_ANALYZER_DOCUMENT_CLASS_HPP_INCLUDED
12 #include <vector>
13 #include <string>
14 #include <cstring>
15 
17 namespace strus {
18 namespace analyzer {
19 
22 {
23 public:
27  explicit DocumentClass(
28  const std::string& mimeType_) :m_mimeType(mimeType_){}
31  const std::string& mimeType_,
32  const std::string& encoding_) :m_mimeType(mimeType_),m_encoding(encoding_){}
35  const std::string& mimeType_,
36  const std::string& encoding_,
37  const std::string& scheme_) :m_mimeType(mimeType_),m_scheme(scheme_),m_encoding(encoding_){}
39 #if __cplusplus >= 201103L
40  DocumentClass( DocumentClass&& ) = default;
41  DocumentClass( const DocumentClass& ) = default;
42  DocumentClass& operator= ( DocumentClass&& ) = default;
43  DocumentClass& operator= ( const DocumentClass& ) = default;
44 #else
45  DocumentClass( const DocumentClass& o) :m_mimeType(o.m_mimeType),m_scheme(o.m_scheme),m_encoding(o.m_encoding){}
46 #endif
47 
50  void setMimeType( const std::string& mimeType_) {m_mimeType = mimeType_;}
53  void setScheme( const std::string& scheme_) {m_scheme = scheme_;}
56  void setEncoding( const std::string& encoding_) {m_encoding = encoding_;}
57 
60  const std::string& mimeType() const {return m_mimeType;}
63  const std::string& scheme() const {return m_scheme;}
66  const std::string& encoding() const {return m_encoding;}
67 
70  bool defined() const {return !m_mimeType.empty();}
74  int level() const {return m_mimeType.empty()?0:(1+!m_scheme.empty()+!m_encoding.empty());}
75 
76 private:
77  std::string m_mimeType;
78  std::string m_scheme;
79  std::string m_encoding;
80 };
81 
82 }}//namespace
83 #endif
84 
Defines a description of the properties of an original document processed by the segmenter.
Definition: documentClass.hpp:21
DocumentClass(const std::string &mimeType_)
Constructor.
Definition: documentClass.hpp:27
DocumentClass(const std::string &mimeType_, const std::string &encoding_)
Constructor.
Definition: documentClass.hpp:30
const std::string & mimeType() const
Get the MIME type of the document class.
Definition: documentClass.hpp:60
void setMimeType(const std::string &mimeType_)
Set the MIME type of the document class.
Definition: documentClass.hpp:50
void setScheme(const std::string &scheme_)
Set the scheme identifier of the document class.
Definition: documentClass.hpp:53
const std::string & encoding() const
Get the character set encoding of the document class.
Definition: documentClass.hpp:66
bool defined() const
Evaluate if this document class definition is defined.
Definition: documentClass.hpp:70
DocumentClass()
Default constructor.
Definition: documentClass.hpp:25
void setEncoding(const std::string &encoding_)
Set the character set encoding of the document class.
Definition: documentClass.hpp:56
int level() const
Evaluate the level of definition of the document class.
Definition: documentClass.hpp:74
DocumentClass(const std::string &mimeType_, const std::string &encoding_, const std::string &scheme_)
Constructor.
Definition: documentClass.hpp:34
DocumentClass(const DocumentClass &o)
Copy constructor.
Definition: documentClass.hpp:45
const std::string & scheme() const
Get the scheme identifier of the document class.
Definition: documentClass.hpp:63