1
0
Fork 0

merged string-buffer.h and StringBuffer.h

This commit is contained in:
Jan Steemann 2016-01-06 13:24:09 +01:00
parent bdc51bca80
commit 9a1d7959e9
32 changed files with 434 additions and 480 deletions

View File

@ -27,10 +27,9 @@
#include <boost/test/unit_test.hpp>
#include "Basics/StringBuffer.h"
#include "Basics/fpconv.h"
#include "Basics/json.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
using namespace triagens::basics;

View File

@ -28,7 +28,7 @@
#include <boost/test/unit_test.hpp>
#include "Basics/json.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
// -----------------------------------------------------------------------------
// --SECTION-- private macros

View File

@ -27,8 +27,8 @@
#include <boost/test/unit_test.hpp>
#include "Basics/string-buffer.h"
#include "Basics/json-utilities.h"
#include "Basics/StringBuffer.h"
// -----------------------------------------------------------------------------
// --SECTION-- private macros

View File

@ -28,7 +28,7 @@
#include <boost/test/unit_test.hpp>
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
// -----------------------------------------------------------------------------
// --SECTION-- private macros

View File

@ -31,7 +31,7 @@
#include "Basics/conversions.h"
#include "Basics/json-utilities.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/StringUtils.h"
#include "Basics/VelocyPackHelper.h"
#include "Cluster/ServerState.h"

View File

@ -31,11 +31,11 @@
#include "Aql/Query.h"
#include "Aql/QueryList.h"
#include "Basics/StringUtils.h"
#include "Basics/conversions.h"
#include "Basics/json.h"
#include "Basics/string-buffer.h"
#include "Basics/json-utilities.h"
#include "Basics/StringBuffer.h"
#include "Basics/StringUtils.h"
#include "Basics/VelocyPackHelper.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"

View File

@ -29,9 +29,9 @@
#include "RestVocbaseBaseHandler.h"
#include "Basics/StringUtils.h"
#include "Basics/conversions.h"
#include "Basics/string-buffer.h"
#include "Basics/StringUtils.h"
#include "Basics/StringBuffer.h"
#include "Basics/tri-strings.h"
#include "Rest/HttpRequest.h"
#include "Utils/DocumentHelper.h"

View File

@ -31,7 +31,7 @@
#include "Aql/Query.h"
#include "Basics/logging.h"
#include "Basics/random.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Indexes/FulltextIndex.h"
#include "Indexes/GeoIndex2.h"
#include "Indexes/HashIndex.h"

View File

@ -29,10 +29,10 @@
#include "v8-shape-conv.h"
#include "Basics/StringUtils.h"
#include "Basics/conversions.h"
#include "Basics/logging.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/StringUtils.h"
#include "Basics/tri-strings.h"
#include "V8/v8-json.h"
#include "V8/v8-utils.h"

View File

@ -33,7 +33,7 @@
#include "Basics/associative.h"
#include "Basics/hashes.h"
#include "Basics/logging.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/tri-strings.h"
#include "Basics/vector.h"

View File

@ -34,7 +34,7 @@
#include "Basics/logging.h"
#include "Basics/ReadLocker.h"
#include "Basics/ScopeGuard.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/StringUtils.h"
#include "Basics/tri-strings.h"
#include "Basics/WriteLocker.h"

View File

@ -31,8 +31,8 @@
#define ARANGODB_VOC_BASE_REPLICATION__DUMP_H 1
#include "Basics/Common.h"
#include "Basics/string-buffer.h"
#include "Basics/Exceptions.h"
#include "Basics/StringBuffer.h"
#include "VocBase/replication-common.h"
#include "VocBase/shaped-json.h"
#include "VocBase/voc-types.h"

View File

@ -32,7 +32,7 @@
#include "Basics/hashes.h"
#include "Basics/logging.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/tri-strings.h"
#include "Basics/vector.h"
#include "Basics/VelocyPackHelper.h"

View File

@ -39,8 +39,8 @@
#include "Basics/init.h"
#include "Basics/logging.h"
#include "Basics/random.h"
#include "Basics/StringBuffer.h"
#include "Basics/tri-strings.h"
#include "Basics/string-buffer.h"
#include "Basics/terminal-utils.h"
#include "Rest/Endpoint.h"
#include "Rest/HttpRequest.h"

View File

@ -29,7 +29,7 @@
#include "Basics/JsonHelper.h"
#include "Basics/conversions.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
using namespace std;
using namespace triagens::basics;

View File

@ -27,7 +27,7 @@
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "string-buffer.h"
#include "StringBuffer.h"
#include "Basics/conversions.h"
#include "Basics/fpconv.h"
#include "Zip/zip.h"

View File

@ -39,11 +39,404 @@
#include "Basics/Common.h"
#include "Basics/Exceptions.h"
#include "Basics/string-buffer.h"
#include "Zip/zip.h"
#include <sstream>
// -----------------------------------------------------------------------------
// --SECTION-- public types
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief string buffer with formatting routines
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_string_buffer_s {
TRI_memory_zone_t* _memoryZone;
char* _buffer;
char* _current;
size_t _len;
} TRI_string_buffer_t;
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief create a new string buffer and initialize it
////////////////////////////////////////////////////////////////////////////////
TRI_string_buffer_t* TRI_CreateStringBuffer(TRI_memory_zone_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief create a new string buffer and initialize it with a specific size
////////////////////////////////////////////////////////////////////////////////
TRI_string_buffer_t* TRI_CreateSizedStringBuffer(TRI_memory_zone_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief initializes the string buffer
///
/// @warning You must call initialize before using the string buffer.
////////////////////////////////////////////////////////////////////////////////
void TRI_InitStringBuffer(TRI_string_buffer_t*, TRI_memory_zone_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief initializes the string buffer with a specific size
///
/// @warning You must call initialize before using the string buffer.
////////////////////////////////////////////////////////////////////////////////
void TRI_InitSizedStringBuffer(TRI_string_buffer_t*, TRI_memory_zone_t*,
const size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief frees the string buffer
///
/// @warning You must call free or destroy after using the string buffer.
////////////////////////////////////////////////////////////////////////////////
void TRI_DestroyStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief frees the string buffer and cleans the buffer
///
/// @warning You must call free after or destroy using the string buffer.
////////////////////////////////////////////////////////////////////////////////
void TRI_AnnihilateStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief frees the string buffer and the pointer
////////////////////////////////////////////////////////////////////////////////
void TRI_FreeStringBuffer(TRI_memory_zone_t*, TRI_string_buffer_t*);
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief compress the string buffer using deflate
////////////////////////////////////////////////////////////////////////////////
int TRI_DeflateStringBuffer(TRI_string_buffer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief ensure the string buffer has a specific capacity
////////////////////////////////////////////////////////////////////////////////
int TRI_ReserveStringBuffer(TRI_string_buffer_t*, const size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief swaps content with another string buffer
////////////////////////////////////////////////////////////////////////////////
void TRI_SwapStringBuffer(TRI_string_buffer_t*, TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns pointer to the beginning of the character buffer
////////////////////////////////////////////////////////////////////////////////
char const* TRI_BeginStringBuffer(TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns pointer to the end of the character buffer
////////////////////////////////////////////////////////////////////////////////
char const* TRI_EndStringBuffer(TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns length of the character buffer
////////////////////////////////////////////////////////////////////////////////
size_t TRI_LengthStringBuffer(TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief increases length of the character buffer
////////////////////////////////////////////////////////////////////////////////
void TRI_IncreaseLengthStringBuffer(TRI_string_buffer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns true if buffer is empty
////////////////////////////////////////////////////////////////////////////////
bool TRI_EmptyStringBuffer(TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief clears the buffer
////////////////////////////////////////////////////////////////////////////////
void TRI_ClearStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief resets the buffer (without clearing)
////////////////////////////////////////////////////////////////////////////////
void TRI_ResetStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief steals the buffer of a string buffer
////////////////////////////////////////////////////////////////////////////////
char* TRI_StealStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief copies the string buffer
////////////////////////////////////////////////////////////////////////////////
int TRI_CopyStringBuffer(TRI_string_buffer_t*, TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief removes the first characters
////////////////////////////////////////////////////////////////////////////////
void TRI_EraseFrontStringBuffer(TRI_string_buffer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief removes the first characters but does not clear the remaining
/// buffer space
////////////////////////////////////////////////////////////////////////////////
void TRI_MoveFrontStringBuffer(TRI_string_buffer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief replaces characters
////////////////////////////////////////////////////////////////////////////////
int TRI_ReplaceStringStringBuffer(TRI_string_buffer_t*, char const*, size_t);
// -----------------------------------------------------------------------------
// --SECTION-- STRING APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends character
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCharStringBuffer(TRI_string_buffer_t* self, char chr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendStringStringBuffer(TRI_string_buffer_t* self, char const* str);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendString2StringBuffer(TRI_string_buffer_t* self, char const* str,
size_t len);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters but url-encode the string
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUrlEncodedStringStringBuffer(TRI_string_buffer_t* self,
char const* str);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters but json-encode the null-terminated string
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendJsonEncodedStringStringBuffer(TRI_string_buffer_t* self,
char const* str, bool);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters but json-encode the string
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendJsonEncodedStringStringBuffer(TRI_string_buffer_t* self,
char const* str, size_t, bool);
// -----------------------------------------------------------------------------
// --SECTION-- INTEGER APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with two digits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInteger2StringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with three digits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInteger3StringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with four digits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInteger4StringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with 8 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInt8StringBuffer(TRI_string_buffer_t* self, int8_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 8 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt8StringBuffer(TRI_string_buffer_t* self, uint8_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with 16 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInt16StringBuffer(TRI_string_buffer_t* self, int16_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 32 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt16StringBuffer(TRI_string_buffer_t* self, uint16_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with 32 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInt32StringBuffer(TRI_string_buffer_t* self, int32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 32 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt32StringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with 64 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInt64StringBuffer(TRI_string_buffer_t* self, int64_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 64 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt64StringBuffer(TRI_string_buffer_t* self, uint64_t attr);
// -----------------------------------------------------------------------------
// --SECTION-- INTEGER OCTAL APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 32 bits in octal
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt32OctalStringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 64 bits in octal
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt64OctalStringBuffer(TRI_string_buffer_t* self, uint64_t attr);
// -----------------------------------------------------------------------------
// --SECTION-- INTEGER HEX APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 32 bits in hex
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt32HexStringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 64 bits in hex
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt64HexStringBuffer(TRI_string_buffer_t* self, uint64_t attr);
// -----------------------------------------------------------------------------
// --SECTION-- FLOAT APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends floating point number with 8 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendDoubleStringBuffer(TRI_string_buffer_t* self, double attr);
// -----------------------------------------------------------------------------
// --SECTION-- DATE AND TIME APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends time in standard format
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendTimeStringBuffer(TRI_string_buffer_t* self, int32_t attr);
// -----------------------------------------------------------------------------
// --SECTION-- CSV APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv 32-bit integer
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvInt32StringBuffer(TRI_string_buffer_t* self, int32_t i);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv unisgned 32-bit integer
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvUInt32StringBuffer(TRI_string_buffer_t* self, uint32_t i);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv 64-bit integer
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvInt64StringBuffer(TRI_string_buffer_t* self, int64_t i);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv unsigned 64-bit integer
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvUInt64StringBuffer(TRI_string_buffer_t* self, uint64_t i);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv double
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvDoubleStringBuffer(TRI_string_buffer_t* self, double d);
// -----------------------------------------------------------------------------
// string buffer with formatting routines
// -----------------------------------------------------------------------------

View File

@ -25,7 +25,8 @@
/// @author Copyright 2015, ArangoDB GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "string-buffer.h"
#include "Basics/StringBuffer.h"
#include <velocypack/Sink.h>
#include <velocypack/velocypack-aliases.h>

View File

@ -30,7 +30,7 @@
#include "conversions.h"
#include "Basics/fpconv.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/tri-strings.h"
// -----------------------------------------------------------------------------

View File

@ -46,7 +46,7 @@
#include "Basics/locks.h"
#include "Basics/logging.h"
#include "Basics/random.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/threads.h"
#include "Basics/tri-strings.h"

View File

@ -30,7 +30,7 @@
#include "Basics/json-utilities.h"
#include "Basics/fasthash.h"
#include "Basics/hashes.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/Utf8Helper.h"
// -----------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
#include "json.h"
#include "Basics/files.h"
#include "Basics/logging.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/tri-strings.h"
// -----------------------------------------------------------------------------

View File

@ -160,7 +160,7 @@ int TRI_MMFileAdvise(void* memoryAddress, size_t numOfBytes, int advice) {
char buffer[256];
char* p = strerror_r(errno, buffer, 256);
LOG_INFO("madvise %d for %llu length %llu failed with: %s ", advice,
(unsigned long long)memoryAddress, (unsigned long long)numOfBytes,
(unsigned long long) memoryAddress, (unsigned long long) numOfBytes,
p);
return TRI_ERROR_INTERNAL;
}

View File

@ -57,11 +57,11 @@
#include <TlHelp32.h>
#endif
#include "Basics/tri-strings.h"
#include "Basics/string-buffer.h"
#include "Basics/locks.h"
#include "Basics/logging.h"
#include "Basics/StringBuffer.h"
#include "Basics/StringUtils.h"
#include "Basics/tri-strings.h"
// -----------------------------------------------------------------------------
// --SECTION-- global variables

View File

@ -1,438 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief a string buffer for sequential string concatenation
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2014 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 Dr. Frank Celler
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGODB_BASICS_C_STRING__BUFFER_H
#define ARANGODB_BASICS_C_STRING__BUFFER_H 1
#include "Basics/Common.h"
// -----------------------------------------------------------------------------
// --SECTION-- public types
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief string buffer with formatting routines
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_string_buffer_s {
TRI_memory_zone_t* _memoryZone;
char* _buffer;
char* _current;
size_t _len;
} TRI_string_buffer_t;
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief create a new string buffer and initialize it
////////////////////////////////////////////////////////////////////////////////
TRI_string_buffer_t* TRI_CreateStringBuffer(TRI_memory_zone_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief create a new string buffer and initialize it with a specific size
////////////////////////////////////////////////////////////////////////////////
TRI_string_buffer_t* TRI_CreateSizedStringBuffer(TRI_memory_zone_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief initializes the string buffer
///
/// @warning You must call initialize before using the string buffer.
////////////////////////////////////////////////////////////////////////////////
void TRI_InitStringBuffer(TRI_string_buffer_t*, TRI_memory_zone_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief initializes the string buffer with a specific size
///
/// @warning You must call initialize before using the string buffer.
////////////////////////////////////////////////////////////////////////////////
void TRI_InitSizedStringBuffer(TRI_string_buffer_t*, TRI_memory_zone_t*,
const size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief frees the string buffer
///
/// @warning You must call free or destroy after using the string buffer.
////////////////////////////////////////////////////////////////////////////////
void TRI_DestroyStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief frees the string buffer and cleans the buffer
///
/// @warning You must call free after or destroy using the string buffer.
////////////////////////////////////////////////////////////////////////////////
void TRI_AnnihilateStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief frees the string buffer and the pointer
////////////////////////////////////////////////////////////////////////////////
void TRI_FreeStringBuffer(TRI_memory_zone_t*, TRI_string_buffer_t*);
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief compress the string buffer using deflate
////////////////////////////////////////////////////////////////////////////////
int TRI_DeflateStringBuffer(TRI_string_buffer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief ensure the string buffer has a specific capacity
////////////////////////////////////////////////////////////////////////////////
int TRI_ReserveStringBuffer(TRI_string_buffer_t*, const size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief swaps content with another string buffer
////////////////////////////////////////////////////////////////////////////////
void TRI_SwapStringBuffer(TRI_string_buffer_t*, TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns pointer to the beginning of the character buffer
////////////////////////////////////////////////////////////////////////////////
char const* TRI_BeginStringBuffer(TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns pointer to the end of the character buffer
////////////////////////////////////////////////////////////////////////////////
char const* TRI_EndStringBuffer(TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns length of the character buffer
////////////////////////////////////////////////////////////////////////////////
size_t TRI_LengthStringBuffer(TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief increases length of the character buffer
////////////////////////////////////////////////////////////////////////////////
void TRI_IncreaseLengthStringBuffer(TRI_string_buffer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns true if buffer is empty
////////////////////////////////////////////////////////////////////////////////
bool TRI_EmptyStringBuffer(TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief clears the buffer
////////////////////////////////////////////////////////////////////////////////
void TRI_ClearStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief resets the buffer (without clearing)
////////////////////////////////////////////////////////////////////////////////
void TRI_ResetStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief steals the buffer of a string buffer
////////////////////////////////////////////////////////////////////////////////
char* TRI_StealStringBuffer(TRI_string_buffer_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief copies the string buffer
////////////////////////////////////////////////////////////////////////////////
int TRI_CopyStringBuffer(TRI_string_buffer_t*, TRI_string_buffer_t const*);
////////////////////////////////////////////////////////////////////////////////
/// @brief removes the first characters
////////////////////////////////////////////////////////////////////////////////
void TRI_EraseFrontStringBuffer(TRI_string_buffer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief removes the first characters but does not clear the remaining
/// buffer space
////////////////////////////////////////////////////////////////////////////////
void TRI_MoveFrontStringBuffer(TRI_string_buffer_t*, size_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief replaces characters
////////////////////////////////////////////////////////////////////////////////
int TRI_ReplaceStringStringBuffer(TRI_string_buffer_t*, char const*, size_t);
// -----------------------------------------------------------------------------
// --SECTION-- STRING APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends character
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCharStringBuffer(TRI_string_buffer_t* self, char chr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendStringStringBuffer(TRI_string_buffer_t* self, char const* str);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendString2StringBuffer(TRI_string_buffer_t* self, char const* str,
size_t len);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters but url-encode the string
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUrlEncodedStringStringBuffer(TRI_string_buffer_t* self,
char const* str);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters but json-encode the null-terminated string
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendJsonEncodedStringStringBuffer(TRI_string_buffer_t* self,
char const* str, bool);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends characters but json-encode the string
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendJsonEncodedStringStringBuffer(TRI_string_buffer_t* self,
char const* str, size_t, bool);
// -----------------------------------------------------------------------------
// --SECTION-- INTEGER APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with two digits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInteger2StringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with three digits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInteger3StringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with four digits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInteger4StringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with 8 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInt8StringBuffer(TRI_string_buffer_t* self, int8_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 8 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt8StringBuffer(TRI_string_buffer_t* self, uint8_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with 16 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInt16StringBuffer(TRI_string_buffer_t* self, int16_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 32 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt16StringBuffer(TRI_string_buffer_t* self, uint16_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with 32 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInt32StringBuffer(TRI_string_buffer_t* self, int32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 32 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt32StringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends integer with 64 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendInt64StringBuffer(TRI_string_buffer_t* self, int64_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 64 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt64StringBuffer(TRI_string_buffer_t* self, uint64_t attr);
// -----------------------------------------------------------------------------
// --SECTION-- INTEGER OCTAL APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 32 bits in octal
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt32OctalStringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 64 bits in octal
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt64OctalStringBuffer(TRI_string_buffer_t* self, uint64_t attr);
// -----------------------------------------------------------------------------
// --SECTION-- INTEGER HEX APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 32 bits in hex
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt32HexStringBuffer(TRI_string_buffer_t* self, uint32_t attr);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends unsigned integer with 64 bits in hex
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendUInt64HexStringBuffer(TRI_string_buffer_t* self, uint64_t attr);
// -----------------------------------------------------------------------------
// --SECTION-- FLOAT APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends floating point number with 8 bits
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendDoubleStringBuffer(TRI_string_buffer_t* self, double attr);
// -----------------------------------------------------------------------------
// --SECTION-- DATE AND TIME APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends time in standard format
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendTimeStringBuffer(TRI_string_buffer_t* self, int32_t attr);
// -----------------------------------------------------------------------------
// --SECTION-- CSV APPENDERS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv 32-bit integer
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvInt32StringBuffer(TRI_string_buffer_t* self, int32_t i);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv unisgned 32-bit integer
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvUInt32StringBuffer(TRI_string_buffer_t* self, uint32_t i);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv 64-bit integer
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvInt64StringBuffer(TRI_string_buffer_t* self, int64_t i);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv unsigned 64-bit integer
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvUInt64StringBuffer(TRI_string_buffer_t* self, uint64_t i);
////////////////////////////////////////////////////////////////////////////////
/// @brief appends csv double
////////////////////////////////////////////////////////////////////////////////
int TRI_AppendCsvDoubleStringBuffer(TRI_string_buffer_t* self, double d);
#endif
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|//
// --SECTION--\\|/// @\\}"
// End:

View File

@ -118,7 +118,7 @@ add_library(
Basics/SpinLock.cpp
Basics/SpinLocker.cpp
Basics/ssl-helper.cpp
Basics/string-buffer.cpp
Basics/StringBuffer.cpp
Basics/StringUtils.cpp
Basics/structures.cpp
Basics/system-functions.cpp

View File

@ -56,7 +56,7 @@ lib_libarango_a_SOURCES = \
lib/Basics/SpinLock.cpp \
lib/Basics/SpinLocker.cpp \
lib/Basics/ssl-helper.cpp \
lib/Basics/string-buffer.cpp \
lib/Basics/StringBuffer.cpp \
lib/Basics/StringUtils.cpp \
lib/Basics/structures.cpp \
lib/Basics/system-functions.cpp \

View File

@ -36,7 +36,7 @@
#include "Basics/files.h"
#include "Basics/levenshtein.h"
#include "Basics/logging.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/tri-strings.h"
using namespace std;

View File

@ -35,7 +35,6 @@
#include "Basics/Dictionary.h"
#include "Basics/json.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Rest/ConnectionInfo.h"
#include "Rest/RequestContext.h"

View File

@ -32,8 +32,8 @@
#include "Basics/conversions.h"
#include "Basics/Exceptions.h"
#include "Basics/logging.h"
#include "Basics/StringBuffer.h"
#include "Basics/StringUtils.h"
#include "Basics/string-buffer.h"
#include "Basics/tri-strings.h"
#include "V8/v8-json.h"
#include "V8/v8-utils.h"

View File

@ -34,7 +34,7 @@
#include "Basics/Exceptions.h"
#include "Basics/logging.h"
#include "Basics/shell-colors.h"
#include "Basics/string-buffer.h"
#include "Basics/StringBuffer.h"
#include "Basics/tri-strings.h"
#include "V8/v8-globals.h"
#include "V8/v8-conv.h"

View File

@ -38,18 +38,18 @@
#include <fstream>
#include <iostream>
#include "Basics/Dictionary.h"
#include "Basics/FileUtils.h"
#include "Basics/Nonce.h"
#include "Basics/ProgramOptions.h"
#include "Basics/RandomGenerator.h"
#include "Basics/StringUtils.h"
#include "Basics/conversions.h"
#include "Basics/csv.h"
#include "Basics/Dictionary.h"
#include "Basics/files.h"
#include "Basics/FileUtils.h"
#include "Basics/logging.h"
#include "Basics/Nonce.h"
#include "Basics/process-utils.h"
#include "Basics/string-buffer.h"
#include "Basics/ProgramOptions.h"
#include "Basics/RandomGenerator.h"
#include "Basics/StringBuffer.h"
#include "Basics/StringUtils.h"
#include "Basics/tri-strings.h"
#include "Basics/tri-zip.h"
#include "Basics/Utf8Helper.h"