Loading...
Searching...
No Matches
juce_Identifier.cpp
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
Identifier::Identifier() noexcept {}
Identifier::~Identifier() noexcept {}
Identifier::Identifier (const Identifier& other) noexcept : name (other.name) {}
Identifier::Identifier (Identifier&& other) noexcept : name (std::move (other.name)) {}
Identifier& Identifier::operator= (Identifier&& other) noexcept
{
name = std::move (other.name);
return *this;
}
Identifier& Identifier::operator= (const Identifier& other) noexcept
{
name = other.name;
return *this;
}
Identifier::Identifier (const String& nm)
: name (StringPool::getGlobalPool().getPooledString (nm))
{
// An Identifier cannot be created from an empty string!
jassert (nm.isNotEmpty());
}
Identifier::Identifier (const char* nm)
: name (StringPool::getGlobalPool().getPooledString (nm))
{
// An Identifier cannot be created from an empty string!
jassert (nm != nullptr && nm[0] != 0);
}
Identifier::Identifier (String::CharPointerType start, String::CharPointerType end)
: name (StringPool::getGlobalPool().getPooledString (start, end))
{
// An Identifier cannot be created from an empty string!
jassert (start < end);
}
Identifier Identifier::null;
bool Identifier::isValidIdentifier (const String& possibleIdentifier) noexcept
{
return possibleIdentifier.isNotEmpty()
&& possibleIdentifier.containsOnly ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-:#@$%");
}
} // namespace juce
juce::Identifier
Definition juce_Identifier.h:39
juce::Identifier::Identifier
Identifier() noexcept
Definition juce_Identifier.cpp:26
juce::Identifier::~Identifier
~Identifier() noexcept
Definition juce_Identifier.cpp:27
juce::Identifier::null
static Identifier null
Definition juce_Identifier.h:120
juce::Identifier::isValidIdentifier
static bool isValidIdentifier(const String &possibleIdentifier) noexcept
Definition juce_Identifier.cpp:68
juce::Identifier::operator=
Identifier & operator=(const Identifier &other) noexcept
Definition juce_Identifier.cpp:39
juce::StringPool
Definition juce_StringPool.h:40
juce::String
Definition juce_String.h:53
juce::String::isNotEmpty
bool isNotEmpty() const noexcept
Definition juce_String.h:316