LMMS
Loading...
Searching...
No Matches
Identifier.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the Water library.
5 Copyright (c) 2016 ROLI Ltd.
6 Copyright (C) 2017-2022 Filipe Coelho <falktx@falktx.com>
7
8 Permission is granted to use this software under the terms of the ISC license
9 http://www.isc.org/downloads/software-support-policy/isc-license/
10
11 Permission to use, copy, modify, and/or distribute this software for any
12 purpose with or without fee is hereby granted, provided that the above
13 copyright notice and this permission notice appear in all copies.
14
15 THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
16 TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
18 OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
19 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
21 OF THIS SOFTWARE.
22
23 ==============================================================================
24*/
25
26#ifndef WATER_IDENTIFIER_H_INCLUDED
27#define WATER_IDENTIFIER_H_INCLUDED
28
29#include "String.h"
30
31namespace water {
32
33//==============================================================================
44{
45public:
47 Identifier() noexcept;
48
53 Identifier (const char* name);
54
59 Identifier (const std::string& name);
60
65 Identifier (const char* nameStart, const char* nameEnd);
66
68 Identifier (const Identifier& other) noexcept;
69
71 Identifier& operator= (const Identifier& other) noexcept;
72
74 ~Identifier() noexcept;
75
77 inline bool operator== (const Identifier& other) const noexcept { return name == other.name; }
78
80 inline bool operator!= (const Identifier& other) const noexcept { return name != other.name; }
81
83 inline bool operator== (const char* other) const noexcept { return name == other; }
84
86 inline bool operator!= (const char* other) const noexcept { return name != other; }
87
89 inline bool operator< (const char* other) const noexcept { return name < other; }
90
92 inline bool operator<= (const char* other) const noexcept { return name <= other; }
93
95 inline bool operator> (const char* other) const noexcept { return name > other; }
96
98 inline bool operator>= (const char* other) const noexcept { return name >= other; }
99
101 const std::string& toString() const noexcept { return name; }
102
104 operator StringRef() const noexcept { return StringRef(name.c_str()); }
105
107 bool isValid() const noexcept { return !name.empty(); }
108
110 bool isNull() const noexcept { return name.empty(); }
111
112private:
113 std::string name;
114};
115
116}
117
118#endif // WATER_IDENTIFIER_H_INCLUDED
#define noexcept
Definition DistrhoDefines.h:72
bool isValid() const noexcept
Definition Identifier.h:107
bool operator<(const char *other) const noexcept
Definition Identifier.h:89
bool operator<=(const char *other) const noexcept
Definition Identifier.h:92
bool operator==(const Identifier &other) const noexcept
Definition Identifier.h:77
bool operator>=(const char *other) const noexcept
Definition Identifier.h:98
bool operator!=(const Identifier &other) const noexcept
Definition Identifier.h:80
const std::string & toString() const noexcept
Definition Identifier.h:101
bool isNull() const noexcept
Definition Identifier.h:110
~Identifier() noexcept
Definition Identifier.cpp:31
Identifier() noexcept
Definition Identifier.cpp:30
Identifier & operator=(const Identifier &other) noexcept
Definition Identifier.cpp:35
std::string name
Definition Identifier.h:113
bool operator>(const char *other) const noexcept
Definition Identifier.h:95
Definition StringRef.h:67
Definition AudioSampleBuffer.h:33
#define const
Definition zconf.h:137