From 63a2ec49b38131df3aedee56ec041d6107aa36fc Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Mon, 19 Jan 2015 17:09:34 +0200 Subject: [PATCH] cql3: Convert ColumnIdentifier.Raw to C++ Signed-off-by: Pekka Enberg --- cql3/column_identifier.hh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/cql3/column_identifier.hh b/cql3/column_identifier.hh index 4aa0a42cc1..38507f88bd 100644 --- a/cql3/column_identifier.hh +++ b/cql3/column_identifier.hh @@ -140,6 +140,7 @@ public: return SimpleSelector.newFactory(def.name.toString(), addAndGetIndex(def, defs), def.type); } +#endif /** * Because Thrift-created tables may have a non-text comparator, we cannot determine the proper 'key' until @@ -147,17 +148,21 @@ public: * once the comparator is known with prepare(). This should only be used with identifiers that are actual * column names. See CASSANDRA-8178 for more background. */ - public static class Raw implements Selectable.Raw - { - private final String rawText; - private final String text; - - public Raw(String rawText, boolean keepCase) + class raw : public selectable::raw { + private: + const sstring _raw_text; + sstring _text; + public: + raw(sstring raw_text, bool keep_case) + : _raw_text{raw_text} + , _text{raw_text} { - this.rawText = rawText; - this.text = keepCase ? rawText : rawText.toLowerCase(Locale.US); + if (!keep_case) { + std::transform(_text.begin(), _text.end(), _text.begin(), ::tolower); + } } +#if 0 public ColumnIdentifier prepare(CFMetaData cfm) { AbstractType comparator = cfm.comparator.asAbstractType(); @@ -201,8 +206,8 @@ public: { return text; } - } #endif + }; }; }