Hyper API for C++ 0.0.20746
Hyper client library for C++ applications
Loading...
Searching...
No Matches
SchemaName.hpp
Go to the documentation of this file.
1
5#ifndef TABLEAU_HYPER_SCHEMANAME_HPP
6#define TABLEAU_HYPER_SCHEMANAME_HPP
7
9#include <hyperapi/Name.hpp>
10
11namespace hyperapi {
14 public:
18 SchemaName(Name name) : name_(std::move(name)) {}
19
21 SchemaName(std::string name) : SchemaName(Name(name)) {}
22
27 SchemaName(const char* name) : SchemaName(Name(name)) {}
28
32 SchemaName(DatabaseName databaseName, Name name) : databaseName_(std::move(databaseName)), name_(std::move(name)) {}
33
35 std::string toString() const;
36
38 const Name& getName() const noexcept { return name_; }
39
41 const optional<DatabaseName>& getDatabaseName() const noexcept { return databaseName_; }
42
44 bool isFullyQualified() const noexcept { return databaseName_.has_value(); }
45
46 private:
48 optional<DatabaseName> databaseName_;
50 Name name_;
51};
52
54inline std::ostream& operator<<(std::ostream& os, const SchemaName& name) { return os << name.toString(); }
55
57inline bool operator<(const SchemaName& a, const SchemaName& b) noexcept;
59inline bool operator==(const SchemaName& a, const SchemaName& b) noexcept { return (a.getDatabaseName() == b.getDatabaseName()) && (a.getName() == b.getName()); }
61inline bool operator>(const SchemaName& a, const SchemaName& b) noexcept { return b < a; }
63inline bool operator!=(const SchemaName& a, const SchemaName& b) noexcept { return !(a == b); }
65inline bool operator<=(const SchemaName& a, const SchemaName& b) noexcept { return !(a > b); }
67inline bool operator>=(const SchemaName& a, const SchemaName& b) noexcept { return !(a < b); }
68}
69
70#include <hyperapi/impl/SchemaName.impl.hpp>
71#endif
Represents an escaped SQL database name.
Represents an escaped SQL name.
Definition Name.hpp:18
Represents an escaped SQL schema name.
SchemaName(DatabaseName databaseName, Name name)
Constructor for a qualified schema name.
SchemaName(Name name)
Constructor for a non-qualified schema name.
const Name & getName() const noexcept
bool isFullyQualified() const noexcept
SchemaName(std::string name)
Constructor for a non-qualified schema name.
std::string toString() const
SchemaName(const char *name)
Constructor for a non-qualified schema name.
const optional< DatabaseName > & getDatabaseName() const noexcept
Surrogate for C++17 std::optional
Definition optional.hpp:40
The primary namespace of the Hyper API for C++.
Definition ByteSpan.hpp:15
bool operator<(const DatabaseName &a, const DatabaseName &b) noexcept
Smaller operator.
bool operator==(const DatabaseName &a, const DatabaseName &b) noexcept
Equality operator.
bool operator>(const DatabaseName &a, const DatabaseName &b) noexcept
Greater operator.
bool operator!=(const DatabaseName &a, const DatabaseName &b) noexcept
Not equal operator.
bool operator>=(const DatabaseName &a, const DatabaseName &b) noexcept
Greater or equal operator.
std::ostream & operator<<(std::ostream &os, const DatabaseName &name)
Stream output operator.
bool operator<=(const DatabaseName &a, const DatabaseName &b) noexcept
Smaller or equal operator.