KiCad PCB EDA Suite
properties.h
Go to the documentation of this file.
1 #ifndef _PROPERTIES_H_
2 #define _PROPERTIES_H_
3 
4 /*
5  * This program source code file is part of KICAD, a free EDA CAD application.
6  *
7  * Copyright (C) 2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
8  * Copyright (C) 2016 Kicad Developers, see AUTHORS.txt for contributors.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #include <string>
25 #include <map>
26 #include <utf8.h>
27 
28 
34 class PROPERTIES : public std::map< std::string, UTF8 >
35 {
36  // alphabetical tuple of name and value hereby defined.
37 
38 public:
39  bool Clear( const std::string& aProperty )
40  {
41  return erase( aProperty ) > 0;
42  }
43 
44  bool Exists( const std::string& aProperty ) const
45  {
46  return count( aProperty ) > 0;
47  }
48 
58  bool Value( const char* aName, UTF8* aFetchedValue = NULL ) const;
59 };
60 
61 #endif // _PROPERTIES_H_
Class UTF8 is an 8 bit string that is assuredly encoded in UTF8, and supplies special conversion supp...
Definition: utf8.h:73
bool Value(const char *aName, UTF8 *aFetchedValue=NULL) const
Function Value fetches a property by aName and returns true if that property was found, else false.
Definition: properties.cpp:24
bool Exists(const std::string &aProperty) const
Definition: properties.h:44
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
bool Clear(const std::string &aProperty)
Definition: properties.h:39