NCBI C++ ToolKit
string_constraint.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: string_constraint.hpp 93572 2021-04-30 13:48:31Z stakhovv $
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: Colleen Bollin
27  */
28 
29 
30 #ifndef _STRING_CONSTRAINT_H_
31 #define _STRING_CONSTRAINT_H_
32 
33 #include <corelib/ncbistd.hpp>
34 
35 #include <objmgr/scope.hpp>
36 
37 #include <objmgr/scope.hpp>
38 #include <objmgr/bioseq_handle.hpp>
39 
40 
44 
45 
61 };
62 
63 
64 /// Add text to an existing string, using the "existing_text" directive to combine
65 /// new text with existing text
66 NCBI_XOBJEDIT_EXPORT bool AddValueToString (string& str, const string& value, EExistingText existing_text);
67 
68 
70 {
71 public:
72  enum EMatchType {
73  eMatchType_Contains = 0,
77  eMatchType_IsOneOf
78  };
79 
80  CStringConstraint(const string& match_text,
81  EMatchType match_type = eMatchType_Contains,
82  bool ignore_case = false,
83  bool ignore_space = false,
84  bool negation = false)
85  : m_MatchText(match_text),
86  m_MatchType(match_type),
87  m_IgnoreCase(ignore_case),
88  m_IgnoreSpace(ignore_space),
89  m_NotPresent(negation) {}
91 
92  void SetNegation(bool val) { m_NotPresent = val; }
93  void SetIgnoreCase(bool val) { m_IgnoreCase = val; }
94  void SetIgnoreSpace(bool val) { m_IgnoreSpace = val; }
95  bool GetNegation() { return m_NotPresent; }
96  bool GetIgnoreCase() { return m_IgnoreCase; }
97  bool GetIgnoreSpace() { return m_IgnoreSpace; }
98  bool DoesTextMatch(const string& text);
99  bool DoesListMatch(const vector<string>& vals);
100  EMatchType GetMatchType() { return m_MatchType; }
101  void SetMatchType(EMatchType match_type) { m_MatchType = match_type; }
102  const string& GetMatchText() { return m_MatchText; }
103  void SetMatchText(const string& match_text) { m_MatchText = match_text; }
104  void Assign(const CStringConstraint& other);
105  bool IsInRange(const string& str, const string &tmp);
106 private:
107  string m_MatchText;
112 };
113 
117 
118 #endif
119 
CObject –.
Definition: ncbiobj.hpp:180
const string & GetMatchText()
CStringConstraint(const string &match_text, EMatchType match_type=eMatchType_Contains, bool ignore_case=false, bool ignore_space=false, bool negation=false)
void SetIgnoreSpace(bool val)
void SetIgnoreCase(bool val)
void SetNegation(bool val)
void SetMatchType(EMatchType match_type)
void SetMatchText(const string &match_text)
char value[7]
Definition: config.c:431
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define NCBI_XOBJEDIT_EXPORT
Definition: ncbi_export.h:1291
static void text(MDB_val *v)
Definition: mdb_dump.c:62
Definition: fix_pub.hpp:45
static char tmp[2048]
Definition: utf8.c:42
static const char * str(char *buf, int n)
Definition: stats.c:84
EExistingText
@ eExistingText_cancel
@ eExistingText_append_semi
@ eExistingText_append_space
@ eExistingText_prefix_colon
@ eExistingText_add_qual
@ eExistingText_append_none
@ eExistingText_leave_old
@ eExistingText_prefix_none
@ eExistingText_prefix_space
@ eExistingText_append_colon
@ eExistingText_prefix_comma
@ eExistingText_append_comma
@ eExistingText_prefix_semi
@ eExistingText_replace_old
bool AddValueToString(string &str, const string &value, EExistingText existing_text)
Add text to an existing string, using the "existing_text" directive to combine new text with existing...
Modified on Fri Dec 08 08:19:11 2023 by modify_doxy.py rev. 669887