Hyper API for C++  0.0.15888
Hyper client library for C++ applications
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 
11 namespace hyperapi {
13 class SchemaName {
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 
54 inline std::ostream& operator<<(std::ostream& os, const SchemaName& name) { return os << name.toString(); }
55 
57 inline bool operator<(const SchemaName& a, const SchemaName& b) noexcept;
59 inline bool operator==(const SchemaName& a, const SchemaName& b) noexcept { return (a.getDatabaseName() == b.getDatabaseName()) && (a.getName() == b.getName()); }
61 inline bool operator>(const SchemaName& a, const SchemaName& b) noexcept { return b < a; }
63 inline bool operator!=(const SchemaName& a, const SchemaName& b) noexcept { return !(a == b); }
65 inline bool operator<=(const SchemaName& a, const SchemaName& b) noexcept { return !(a > b); }
67 inline bool operator>=(const SchemaName& a, const SchemaName& b) noexcept { return !(a < b); }
68 }
69 
70 #include <hyperapi/impl/SchemaName.impl.hpp>
71 #endif
hyperapi::operator<
bool operator<(const DatabaseName &a, const DatabaseName &b) noexcept
Smaller operator.
Definition: DatabaseName.hpp:51
hyperapi::operator<=
bool operator<=(const DatabaseName &a, const DatabaseName &b) noexcept
Smaller or equal operator.
Definition: DatabaseName.hpp:59
hyperapi::operator>=
bool operator>=(const DatabaseName &a, const DatabaseName &b) noexcept
Greater or equal operator.
Definition: DatabaseName.hpp:61
hyperapi::Name
Represents an escaped SQL name.
Definition: Name.hpp:18
DatabaseName.hpp
hyperapi::operator>
bool operator>(const DatabaseName &a, const DatabaseName &b) noexcept
Greater operator.
Definition: DatabaseName.hpp:55
hyperapi::SchemaName::isFullyQualified
bool isFullyQualified() const noexcept
Definition: SchemaName.hpp:44
hyperapi::SchemaName::getName
const Name & getName() const noexcept
Definition: SchemaName.hpp:38
hyperapi::optional
Surrogate for C++17 std::optional
Definition: optional.hpp:40
hyperapi::operator<<
std::ostream & operator<<(std::ostream &os, const DatabaseName &name)
Stream output operator.
Definition: DatabaseName.hpp:48
hyperapi::SchemaName::SchemaName
SchemaName(DatabaseName databaseName, Name name)
Constructor for a qualified schema name.
Definition: SchemaName.hpp:32
hyperapi::SchemaName::SchemaName
SchemaName(std::string name)
Constructor for a non-qualified schema name.
Definition: SchemaName.hpp:21
hyperapi::operator==
bool operator==(const DatabaseName &a, const DatabaseName &b) noexcept
Equality operator.
Definition: DatabaseName.hpp:53
hyperapi::operator!=
bool operator!=(const DatabaseName &a, const DatabaseName &b) noexcept
Not equal operator.
Definition: DatabaseName.hpp:57
hyperapi::SchemaName::getDatabaseName
const optional< DatabaseName > & getDatabaseName() const noexcept
Definition: SchemaName.hpp:41
hyperapi
The primary namespace of the Hyper API for C++.
Definition: ByteSpan.hpp:15
hyperapi::SchemaName::SchemaName
SchemaName(Name name)
Constructor for a non-qualified schema name.
Definition: SchemaName.hpp:18
hyperapi::SchemaName
Represents an escaped SQL schema name.
Definition: SchemaName.hpp:13
hyperapi::SchemaName::SchemaName
SchemaName(const char *name)
Constructor for a non-qualified schema name.
Definition: SchemaName.hpp:27
hyperapi::DatabaseName
Represents an escaped SQL database name.
Definition: DatabaseName.hpp:12
hyperapi::SchemaName::toString
std::string toString() const
Name.hpp