openshot-audio  0.1.4
juce_Identifier.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_IDENTIFIER_H_INCLUDED
30 #define JUCE_IDENTIFIER_H_INCLUDED
31 
32 
33 //==============================================================================
44 {
45 public:
48 
53  Identifier (const char* name);
54 
59  Identifier (const String& name);
60 
65  Identifier (String::CharPointerType nameStart, String::CharPointerType nameEnd);
66 
68  Identifier (const Identifier& other) noexcept;
69 
71  Identifier& operator= (const Identifier& other) noexcept;
72 
73  #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
74 
75  Identifier (Identifier&& other) noexcept;
76 
78  Identifier& operator= (Identifier&& other) noexcept;
79  #endif
80 
83 
85  inline bool operator== (const Identifier& other) const noexcept { return name.getCharPointer() == other.name.getCharPointer(); }
86 
88  inline bool operator!= (const Identifier& other) const noexcept { return name.getCharPointer() != other.name.getCharPointer(); }
89 
91  inline bool operator== (StringRef other) const noexcept { return name == other; }
92 
94  inline bool operator!= (StringRef other) const noexcept { return name != other; }
95 
97  const String& toString() const noexcept { return name; }
98 
100  operator String::CharPointerType() const noexcept { return name.getCharPointer(); }
101 
103  String::CharPointerType getCharPointer() const noexcept { return name.getCharPointer(); }
104 
106  operator StringRef() const noexcept { return name; }
107 
109  bool isValid() const noexcept { return name.isNotEmpty(); }
110 
112  bool isNull() const noexcept { return name.isEmpty(); }
113 
115  static Identifier null;
116 
121  static bool isValidIdentifier (const String& possibleIdentifier) noexcept;
122 
123 private:
124  String name;
125 };
126 
127 
128 #endif // JUCE_IDENTIFIER_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
bool isNotEmpty() const noexcept
Definition: juce_String.h:308
bool isNull() const noexcept
Definition: juce_Identifier.h:112
CharPointerType getCharPointer() const noexcept
Definition: juce_String.h:1051
bool isValid() const noexcept
Definition: juce_Identifier.h:109
static Identifier null
Definition: juce_Identifier.h:115
bool isEmpty() const noexcept
Definition: juce_String.h:302
bool operator==(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:565
bool operator!=(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:566
Definition: juce_Identifier.h:43
String::CharPointerType getCharPointer() const noexcept
Definition: juce_Identifier.h:103
const String & toString() const noexcept
Definition: juce_Identifier.h:97
Definition: juce_StringRef.h:65