Drop the AGPL license in favor of a source-available license. See the blog post [1] for details. [1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*
|
|
* Modified by ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.0 and Apache-2.0)
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <seastar/core/sstring.hh>
|
|
#include "seastarx.hh"
|
|
|
|
#include <optional>
|
|
|
|
namespace cql3 {
|
|
|
|
/**
|
|
* Base class for the names of the keyspace elements (e.g. table, index ...)
|
|
*/
|
|
class keyspace_element_name {
|
|
/**
|
|
* The keyspace name as stored internally.
|
|
*/
|
|
std::optional<sstring> _ks_name = std::nullopt;
|
|
|
|
public:
|
|
/**
|
|
* Sets the keyspace.
|
|
*
|
|
* @param ks the keyspace name
|
|
* @param keepCase <code>true</code> if the case must be kept, <code>false</code> otherwise.
|
|
*/
|
|
void set_keyspace(std::string_view ks, bool keep_case);
|
|
|
|
/**
|
|
* Checks if the keyspace is specified.
|
|
* @return <code>true</code> if the keyspace is specified, <code>false</code> otherwise.
|
|
*/
|
|
bool has_keyspace() const;
|
|
|
|
const sstring& get_keyspace() const;
|
|
|
|
virtual sstring to_string() const;
|
|
|
|
protected:
|
|
/**
|
|
* Converts the specified name into the name used internally.
|
|
*
|
|
* @param name the name
|
|
* @param keepCase <code>true</code> if the case must be kept, <code>false</code> otherwise.
|
|
* @return the name used internally.
|
|
*/
|
|
static sstring to_internal_name(std::string_view name, bool keep_case);
|
|
};
|
|
|
|
}
|