mirror of https://gitee.com/bigwinds/arangodb
added StringRef implementation file to implement operator<<
This commit is contained in:
parent
893a7ab2b4
commit
0f06a219b6
|
@ -0,0 +1,32 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
||||||
|
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Jan Steemann
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "StringRef.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& stream, arangodb::StringRef const& ref) {
|
||||||
|
stream << std::string(ref.data(), ref.length());
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include <velocypack/Slice.h>
|
#include <velocypack/Slice.h>
|
||||||
#include <velocypack/Value.h>
|
#include <velocypack/Value.h>
|
||||||
|
|
||||||
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
|
|
||||||
/// @brief a struct describing a C character array
|
/// @brief a struct describing a C character array
|
||||||
|
@ -174,6 +176,8 @@ class StringRef {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream&, arangodb::StringRef const&);
|
||||||
|
|
||||||
inline bool operator==(arangodb::StringRef const& lhs, arangodb::StringRef const& rhs) {
|
inline bool operator==(arangodb::StringRef const& lhs, arangodb::StringRef const& rhs) {
|
||||||
return (lhs.size() == rhs.size() && memcmp(lhs.data(), rhs.data(), lhs.size()) == 0);
|
return (lhs.size() == rhs.size() && memcmp(lhs.data(), rhs.data(), lhs.size()) == 0);
|
||||||
}
|
}
|
||||||
|
@ -227,4 +231,5 @@ struct equal_to<arangodb::StringRef> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -140,6 +140,7 @@ add_library(${LIB_ARANGO} STATIC
|
||||||
Basics/StaticStrings.cpp
|
Basics/StaticStrings.cpp
|
||||||
Basics/StringBuffer.cpp
|
Basics/StringBuffer.cpp
|
||||||
Basics/StringHeap.cpp
|
Basics/StringHeap.cpp
|
||||||
|
Basics/StringRef.cpp
|
||||||
Basics/StringUtils.cpp
|
Basics/StringUtils.cpp
|
||||||
Basics/Thread.cpp
|
Basics/Thread.cpp
|
||||||
Basics/ThreadPool.cpp
|
Basics/ThreadPool.cpp
|
||||||
|
|
Loading…
Reference in New Issue