Files
scylladb/cql3/keyspace_element_name.cc
Avi Kivity fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00

49 lines
886 B
C++

/*
*/
/*
* Copyright (C) 2015-present ScyllaDB
*
* Modified by ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#include "cql3/keyspace_element_name.hh"
namespace cql3 {
void keyspace_element_name::set_keyspace(std::string_view ks, bool keep_case)
{
_ks_name = to_internal_name(ks, keep_case);
}
bool keyspace_element_name::has_keyspace() const
{
return bool(_ks_name);
}
const sstring& keyspace_element_name::get_keyspace() const
{
assert(_ks_name);
return *_ks_name;
}
sstring keyspace_element_name::to_internal_name(std::string_view view, bool keep_case)
{
sstring name(view);
if (!keep_case) {
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
}
return name;
}
sstring keyspace_element_name::to_string() const
{
return has_keyspace() ? (get_keyspace() + ".") : "";
}
}