暂时添加了 邮箱不可重复申请帐号
后续改成 邮箱可以申请多个账号, 用邮箱登陆时选择帐号登陆 修改了 MessageSystem 结构
This commit is contained in:
parent
7079d31006
commit
a764f9fcab
@ -12,5 +12,7 @@ add_library(imm_mongodb
|
|||||||
|
|
||||||
target_link_libraries(imm_mongodb
|
target_link_libraries(imm_mongodb
|
||||||
mongocxx
|
mongocxx
|
||||||
|
# mongoc-static-1.0
|
||||||
bsoncxx
|
bsoncxx
|
||||||
|
bson-static-1.0
|
||||||
)
|
)
|
BIN
MDB/imm_mongodb/lib/libbson-static-1.0.a
Normal file
BIN
MDB/imm_mongodb/lib/libbson-static-1.0.a
Normal file
Binary file not shown.
BIN
MDB/imm_mongodb/lib/libmongoc-static-1.0.a
Normal file
BIN
MDB/imm_mongodb/lib/libmongoc-static-1.0.a
Normal file
Binary file not shown.
@ -161,12 +161,12 @@ class MONGOCXX_API create_collection_deprecated {
|
|||||||
const stdx::optional<std::int64_t>& size() const;
|
const stdx::optional<std::int64_t>& size() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Specify configuration to the storage on a per-collection basis.
|
/// Specify configuration to the message_base on a per-collection basis.
|
||||||
///
|
///
|
||||||
/// @note This option is currently only available with the WiredTiger storage engine.
|
/// @note This option is currently only available with the WiredTiger message_base engine.
|
||||||
///
|
///
|
||||||
/// @param storage_engine_opts
|
/// @param storage_engine_opts
|
||||||
/// Configuration options specific to the storage engine.
|
/// Configuration options specific to the message_base engine.
|
||||||
///
|
///
|
||||||
/// @return
|
/// @return
|
||||||
/// A reference to the object on which this member function is being called. This facilitates
|
/// A reference to the object on which this member function is being called. This facilitates
|
||||||
@ -176,10 +176,10 @@ class MONGOCXX_API create_collection_deprecated {
|
|||||||
bsoncxx::document::view_or_value storage_engine_opts);
|
bsoncxx::document::view_or_value storage_engine_opts);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Gets the current storage engine configuration for this collection.
|
/// Gets the current message_base engine configuration for this collection.
|
||||||
///
|
///
|
||||||
/// @return
|
/// @return
|
||||||
/// Configuration options specific to the storage engine.
|
/// Configuration options specific to the message_base engine.
|
||||||
///
|
///
|
||||||
const stdx::optional<bsoncxx::document::view_or_value>& storage_engine() const;
|
const stdx::optional<bsoncxx::document::view_or_value>& storage_engine() const;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace options {
|
|||||||
class MONGOCXX_API index {
|
class MONGOCXX_API index {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
/// Base class representing the optional storage engine options for indexes.
|
/// Base class representing the optional message_base engine options for indexes.
|
||||||
///
|
///
|
||||||
class MONGOCXX_API base_storage_options {
|
class MONGOCXX_API base_storage_options {
|
||||||
public:
|
public:
|
||||||
@ -53,7 +53,7 @@ class MONGOCXX_API index {
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Class representing the optional WiredTiger storage engine options for indexes.
|
/// Class representing the optional WiredTiger message_base engine options for indexes.
|
||||||
///
|
///
|
||||||
class MONGOCXX_API wiredtiger_storage_options final : public base_storage_options {
|
class MONGOCXX_API wiredtiger_storage_options final : public base_storage_options {
|
||||||
public:
|
public:
|
||||||
@ -216,11 +216,11 @@ class MONGOCXX_API index {
|
|||||||
const stdx::optional<bool>& sparse() const;
|
const stdx::optional<bool>& sparse() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Optionally used only in MongoDB 3.0.0 and higher. Specifies the storage engine options for
|
/// Optionally used only in MongoDB 3.0.0 and higher. Specifies the message_base engine options for
|
||||||
/// the index.
|
/// the index.
|
||||||
///
|
///
|
||||||
/// @param storage_options
|
/// @param storage_options
|
||||||
/// The storage engine options for the index.
|
/// The message_base engine options for the index.
|
||||||
///
|
///
|
||||||
/// @return
|
/// @return
|
||||||
/// A reference to the object on which this member function is being called. This facilitates
|
/// A reference to the object on which this member function is being called. This facilitates
|
||||||
@ -229,11 +229,11 @@ class MONGOCXX_API index {
|
|||||||
index& storage_options(std::unique_ptr<base_storage_options> storage_options);
|
index& storage_options(std::unique_ptr<base_storage_options> storage_options);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Optionally used only in MongoDB 3.0.0 and higher. Specifies the WiredTiger-specific storage
|
/// Optionally used only in MongoDB 3.0.0 and higher. Specifies the WiredTiger-specific message_base
|
||||||
/// engine options for the index.
|
/// engine options for the index.
|
||||||
///
|
///
|
||||||
/// @param storage_options
|
/// @param storage_options
|
||||||
/// The storage engine options for the index.
|
/// The message_base engine options for the index.
|
||||||
///
|
///
|
||||||
index& storage_options(std::unique_ptr<wiredtiger_storage_options> storage_options);
|
index& storage_options(std::unique_ptr<wiredtiger_storage_options> storage_options);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class uri;
|
|||||||
/// collection level. The read concern can also be provided via connection string, and will be
|
/// collection level. The read concern can also be provided via connection string, and will be
|
||||||
/// parsed and set on the client constructed for the URI.
|
/// parsed and set on the client constructed for the URI.
|
||||||
///
|
///
|
||||||
/// For the WiredTiger storage engine, MongoDB 3.2 introduced the readConcern option for replica
|
/// For the WiredTiger message_base engine, MongoDB 3.2 introduced the readConcern option for replica
|
||||||
/// sets and replica set shards. The readConcern option allows clients to choose a level of
|
/// sets and replica set shards. The readConcern option allows clients to choose a level of
|
||||||
/// isolation for their reads. You can specify a readConcern of "majority" to read data that has
|
/// isolation for their reads. You can specify a readConcern of "majority" to read data that has
|
||||||
/// been written to a majority of nodes and thus cannot be rolled back. By default, MongoDB uses a
|
/// been written to a majority of nodes and thus cannot be rolled back. By default, MongoDB uses a
|
||||||
@ -45,7 +45,7 @@ class uri;
|
|||||||
///
|
///
|
||||||
/// MongoDB 3.4 introduces a read concern level of "linearizable" to read data that has been written
|
/// MongoDB 3.4 introduces a read concern level of "linearizable" to read data that has been written
|
||||||
/// to a majority of nodes (i.e. cannot be rolled back) @b and is not stale. Linearizable read
|
/// to a majority of nodes (i.e. cannot be rolled back) @b and is not stale. Linearizable read
|
||||||
/// concern is available for all MongoDB supported storage engines and applies to read operations on
|
/// concern is available for all MongoDB supported message_base engines and applies to read operations on
|
||||||
/// a single document. Note that writes must be made with majority write concern in order for reads
|
/// a single document. Note that writes must be made with majority write concern in order for reads
|
||||||
/// to be linearizable.
|
/// to be linearizable.
|
||||||
///
|
///
|
||||||
|
@ -18,20 +18,31 @@ using bsoncxx::builder::basic::make_document;
|
|||||||
|
|
||||||
class MsgTemplate {
|
class MsgTemplate {
|
||||||
public:
|
public:
|
||||||
static bsoncxx::document::view session_msg(mp::MP_SUB_TYPE msg_type, mp::MP_SUB_TYPE session_type,
|
|
||||||
|
/**
|
||||||
|
* 对于 mongo 的 通用消息 插入模板
|
||||||
|
* @param msg_type 消息类型
|
||||||
|
* @param session_type 会话类型
|
||||||
|
* @param message_id 消息id
|
||||||
|
* @param time 消息时间
|
||||||
|
* @param account 消息来源
|
||||||
|
* @param msg_data 消息数据
|
||||||
|
* @return make_document -》 mongocxx
|
||||||
|
*/
|
||||||
|
static bsoncxx::document::value session_msg(mp::MP_SUB_TYPE msg_type, mp::MP_SUB_TYPE session_type,
|
||||||
int64_t message_id, time_t time, int64_t account,
|
int64_t message_id, time_t time, int64_t account,
|
||||||
const std::string& msg_data) {
|
const std::string& msg_data) {
|
||||||
// 要插入的视图
|
// 要插入的视图
|
||||||
auto doc_value = make_document(
|
auto doc_value = make_document(
|
||||||
kvp("msg_type", msg_type), // 200 text消息
|
kvp("msg_type", msg_type), // 200 text消息
|
||||||
kvp("session_type", session_type), // 300 单体会话
|
kvp("session_type", session_type), // 300 单体会话
|
||||||
kvp("message_id", message_id), // 0 会话级id
|
kvp("msg_id", message_id), // 0 会话级id
|
||||||
kvp("date", time), // 时间
|
kvp("time", time), // 时间
|
||||||
kvp("account", account), // 目标/来源
|
kvp("account", account), // 目标/来源
|
||||||
kvp("msg_data", msg_data.c_str()) // 消息内容
|
kvp("msg_data", msg_data.c_str()) // 消息内容
|
||||||
);
|
);
|
||||||
|
|
||||||
return doc_value.view();
|
return doc_value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,9 +21,15 @@ mp::sri* PEVerifCodeService::send_email(const std::string &target_email, const s
|
|||||||
sri_clear();
|
sri_clear();
|
||||||
|
|
||||||
emailcode = code == "0" ? emailcode : code;
|
emailcode = code == "0" ? emailcode : code;
|
||||||
|
// 检查发送验证码
|
||||||
bool state = send_email_def(target_email, emailcode);
|
bool state = send_email_def(target_email, emailcode);
|
||||||
|
// 检查邮箱
|
||||||
|
auto [is_exist, user] = userDb.select_user(target_email, "email");
|
||||||
|
|
||||||
if (state) {
|
if (is_exist) {
|
||||||
|
sri->set_subcommand(mp::MP_SUB_TYPE::MP_REGISTER_FAIL);
|
||||||
|
sri->set_msg("邮箱已使用!");
|
||||||
|
} else if (state) {
|
||||||
sri->set_subcommand(mp::MP_SUB_TYPE::MP_CODE_SUCCESS);
|
sri->set_subcommand(mp::MP_SUB_TYPE::MP_CODE_SUCCESS);
|
||||||
sri->set_msg("验证码已发送");
|
sri->set_msg("验证码已发送");
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,6 +15,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string emailcode;
|
std::string emailcode;
|
||||||
|
UserDB userDb;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
project(MessageSystem)
|
project(MessageSystem)
|
||||||
|
|
||||||
aux_source_directory(message_push PUSH)
|
aux_source_directory(message_push PUSH)
|
||||||
aux_source_directory(storage STORAGE)
|
aux_source_directory(message_base BASE)
|
||||||
aux_source_directory(synchronization SYN)
|
aux_source_directory(message_pull PULL)
|
||||||
|
aux_source_directory(timeline_safe SAFE_QUEUE)
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/MP)
|
include_directories(${CMAKE_SOURCE_DIR}/MP)
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/MDB/imm_mongodb)
|
include_directories(${CMAKE_SOURCE_DIR}/MDB/imm_mongodb)
|
||||||
|
|
||||||
add_library(MessageSystem
|
add_library(MessageSystem
|
||||||
${PUSH}
|
${PUSH}
|
||||||
${STORAGE}
|
${BASE}
|
||||||
${SYN}
|
${PULL}
|
||||||
TimeLine.cpp
|
${SAFE_QUEUE}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(MessageSystem
|
target_link_libraries(MessageSystem
|
||||||
|
66
MessageSystem/message_base/Storage.cpp
Normal file
66
MessageSystem/message_base/Storage.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
//
|
||||||
|
// Created by dongl on 23-5-29.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "Storage.h"
|
||||||
|
#include "template/MsgTemplate.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
MSG::Storage::Storage(TimeLine<StorageMsg *> *timeLine, db_base* db)
|
||||||
|
: m_timeLine(timeLine), m_db(db), m_db_name(""), m_table("") {
|
||||||
|
storage_push_queue();
|
||||||
|
}
|
||||||
|
|
||||||
|
MSG::Storage::Storage(std::string&& db_name, std::string&& table) : m_db_name(db_name), m_table(table) {
|
||||||
|
m_timeLine = new TimeLine<StorageMsg *>();
|
||||||
|
m_db = new db_base();
|
||||||
|
storage_push_queue();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 储存库 push
|
||||||
|
void MSG::Storage::push(StorageMsg* msg) {
|
||||||
|
// 添加至队列
|
||||||
|
m_timeLine->push(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MSG::Storage::pull() {
|
||||||
|
auto coll = m_db->hit_db_coll(m_db_name, m_table);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MSG::Storage::storage_push_queue() {
|
||||||
|
std::function<void()> fun = [&] {
|
||||||
|
// 取mongo链接
|
||||||
|
auto coll = m_db->hit_db_coll(m_db_name, m_table);
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
while (!m_timeLine->value().empty()) {
|
||||||
|
// if (m_timeLine->value().size() > 10) {
|
||||||
|
// /// 插入多个
|
||||||
|
// } else
|
||||||
|
// {
|
||||||
|
/// 插入单个
|
||||||
|
// 弹出msg队列 此cpp只负责储存库 不负责同步库
|
||||||
|
auto msg = m_timeLine->pull();
|
||||||
|
// 执行插入
|
||||||
|
auto insert_one_result = coll.insert_one(MsgTemplate::session_msg(msg->msg_type, msg->session_type,
|
||||||
|
msg->message_id, msg->time, msg->account, msg->im_msg_data));
|
||||||
|
|
||||||
|
auto doc_id = insert_one_result->inserted_id();
|
||||||
|
printf("[msg insert mongo] %s\n", doc_id.type() == bsoncxx::type::k_oid ? "msg insert" : "not msg insert");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
std::thread t(fun);
|
||||||
|
printf("%ld", t.get_id());
|
||||||
|
t.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "db_base.h"
|
#include "db_base.h"
|
||||||
#include "../TimeLine.h"
|
#include "../timeline_safe/TimeLine.h"
|
||||||
|
|
||||||
namespace MSG {
|
namespace MSG {
|
||||||
class Storage {
|
class Storage {
|
@ -5,10 +5,10 @@
|
|||||||
#ifndef IM2_SYN_H
|
#ifndef IM2_SYN_H
|
||||||
#define IM2_SYN_H
|
#define IM2_SYN_H
|
||||||
|
|
||||||
|
namespace MSG {
|
||||||
|
class Syn {
|
||||||
|
|
||||||
class Syn {
|
};
|
||||||
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //IM2_SYN_H
|
#endif //IM2_SYN_H
|
@ -1,54 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by dongl on 23-5-29.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "Storage.h"
|
|
||||||
#include "template/MsgTemplate.h"
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
MSG::Storage::Storage(TimeLine<StorageMsg *> *timeLine, db_base* db)
|
|
||||||
: m_timeLine(timeLine), m_db(db), m_db_name(""), m_table("") {}
|
|
||||||
|
|
||||||
MSG::Storage::Storage(std::string&& db_name, std::string&& table) : m_db_name(db_name), m_table(table) {
|
|
||||||
m_timeLine = new TimeLine<StorageMsg *>();
|
|
||||||
m_db = new db_base();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 储存库 push
|
|
||||||
void MSG::Storage::push(StorageMsg* msg) {
|
|
||||||
// 添加至信箱 同步库
|
|
||||||
m_timeLine->push(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MSG::Storage::pull() {
|
|
||||||
auto coll = m_db->hit_db_coll(m_db_name, m_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MSG::Storage::storage_push_queue() {
|
|
||||||
// 取mongo链接
|
|
||||||
auto coll = m_db->hit_db_coll(m_db_name, m_table);
|
|
||||||
|
|
||||||
std::function<void()> fun = [&] {
|
|
||||||
while (true) {
|
|
||||||
while (!m_timeLine->value().empty()) {
|
|
||||||
// 弹出msg队列 此cpp只负责储存库 不负责同步库
|
|
||||||
auto msg = m_timeLine->pull();
|
|
||||||
// 执行插入
|
|
||||||
coll.insert_one(MsgTemplate::session_msg(msg->msg_type, msg->session_type,
|
|
||||||
msg->message_id, msg->time, msg->account, msg->im_msg_data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i) {
|
|
||||||
std::thread t(fun);
|
|
||||||
printf("%ld", t.get_id());
|
|
||||||
t.detach();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3,3 +3,5 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "TimeLine.h"
|
#include "TimeLine.h"
|
||||||
|
|
||||||
|
#include <utility>
|
@ -37,7 +37,7 @@ public:
|
|||||||
T pull() {
|
T pull() {
|
||||||
std::lock_guard lockGuard(mutex);
|
std::lock_guard lockGuard(mutex);
|
||||||
auto ele = queue.front();
|
auto ele = queue.front();
|
||||||
queue.back();
|
queue.pop();
|
||||||
return ele;
|
return ele;
|
||||||
}
|
}
|
||||||
|
|
@ -11,6 +11,7 @@
|
|||||||
#include "smtp/send_email.h"
|
#include "smtp/send_email.h"
|
||||||
#include "storage/Storage.h"
|
#include "storage/Storage.h"
|
||||||
#include "IMDataPacket.h"
|
#include "IMDataPacket.h"
|
||||||
|
#include "template/MsgTemplate.h"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
@ -112,11 +113,6 @@ TEST(select_friends_fdb, fecth_frinds_Test) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(MSG_PULL, MSG_PULL__Test) {
|
|
||||||
MSG::Storage* storage = new MSG::Storage();
|
|
||||||
storage->pull();
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(selsct_is_friend, fecth_frinds_Test) {
|
TEST(selsct_is_friend, fecth_frinds_Test) {
|
||||||
auto i = UserFriendsDB();
|
auto i = UserFriendsDB();
|
||||||
auto user = i.select_friend(2725096176, 783556037);
|
auto user = i.select_friend(2725096176, 783556037);
|
||||||
@ -138,4 +134,17 @@ TEST (MP_IM_PUSH_MSG, MP_IM_PUSH_MSG_TEST) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
std::cout << temp->packet() << std::endl;
|
std::cout << temp->packet() << std::endl;
|
||||||
|
|
||||||
|
MSG::Storage* storage = new MSG::Storage("im_session", "chat");
|
||||||
|
|
||||||
|
StorageMsg* msg = new StorageMsg();
|
||||||
|
msg->msg_type = mp::MP_SUB_TYPE::MP_IM_TEXT;
|
||||||
|
msg->session_type = mp::MP_SUB_TYPE::MP_SESSION_FRIEND;
|
||||||
|
msg->message_id = 1;
|
||||||
|
msg->time = time(nullptr);
|
||||||
|
msg->account = 783556037;
|
||||||
|
msg->im_msg_data = "hello test msg!";
|
||||||
|
storage->push(msg);
|
||||||
|
|
||||||
|
sleep(10);
|
||||||
}
|
}
|
@ -357,7 +357,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
|
|||||||
// the call to this method.
|
// the call to this method.
|
||||||
uint64 SpaceUsed() const { return impl_.SpaceUsed(); }
|
uint64 SpaceUsed() const { return impl_.SpaceUsed(); }
|
||||||
|
|
||||||
// Frees all storage allocated by this arena after calling destructors
|
// Frees all message_base allocated by this arena after calling destructors
|
||||||
// registered with OwnDestructor() and freeing objects registered with Own().
|
// registered with OwnDestructor() and freeing objects registered with Own().
|
||||||
// Any objects allocated on this arena are unusable after this call. It also
|
// Any objects allocated on this arena are unusable after this call. It also
|
||||||
// returns the total space used by the arena which is the sums of the sizes
|
// returns the total space used by the arena which is the sums of the sizes
|
||||||
|
@ -289,7 +289,7 @@ class PROTOBUF_EXPORT ArenaImpl {
|
|||||||
static std::atomic<LifecycleId> lifecycle_id_generator_;
|
static std::atomic<LifecycleId> lifecycle_id_generator_;
|
||||||
#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
|
#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
|
||||||
// Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custom thread
|
// Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custom thread
|
||||||
// local storage class we implemented.
|
// local message_base class we implemented.
|
||||||
// iOS also does not support the GOOGLE_THREAD_LOCAL keyword.
|
// iOS also does not support the GOOGLE_THREAD_LOCAL keyword.
|
||||||
static ThreadCache& thread_cache();
|
static ThreadCache& thread_cache();
|
||||||
#elif defined(PROTOBUF_USE_DLLS)
|
#elif defined(PROTOBUF_USE_DLLS)
|
||||||
|
@ -206,7 +206,7 @@ struct PROTOBUF_EXPORT ArenaStringPtr {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frees storage (if not on an arena).
|
// Frees message_base (if not on an arena).
|
||||||
inline void Destroy(const ::std::string* default_value, Arena* arena) {
|
inline void Destroy(const ::std::string* default_value, Arena* arena) {
|
||||||
if (arena == NULL && ptr_ != default_value) {
|
if (arena == NULL && ptr_ != default_value) {
|
||||||
delete ptr_;
|
delete ptr_;
|
||||||
|
@ -1219,7 +1219,7 @@ class PROTOBUF_EXPORT CodedOutputStream {
|
|||||||
// Note that this is *not* canonical across languages. It is also unstable
|
// Note that this is *not* canonical across languages. It is also unstable
|
||||||
// across different builds with intervening message definition changes, due to
|
// across different builds with intervening message definition changes, due to
|
||||||
// unknown fields. Users who need canonical serialization (e.g. persistent
|
// unknown fields. Users who need canonical serialization (e.g. persistent
|
||||||
// storage in a canonical form, fingerprinting) should define their own
|
// message_base in a canonical form, fingerprinting) should define their own
|
||||||
// canonicalization specification and implement the serializer using
|
// canonicalization specification and implement the serializer using
|
||||||
// reflection APIs rather than relying on this API.
|
// reflection APIs rather than relying on this API.
|
||||||
void SetSerializationDeterministic(bool value) {
|
void SetSerializationDeterministic(bool value) {
|
||||||
|
@ -323,7 +323,7 @@ void MapField<Derived, Key, T, kKeyFieldType, kValueFieldType,
|
|||||||
for (typename RepeatedPtrField<EntryType>::iterator it =
|
for (typename RepeatedPtrField<EntryType>::iterator it =
|
||||||
repeated_field->begin();
|
repeated_field->begin();
|
||||||
it != repeated_field->end(); ++it) {
|
it != repeated_field->end(); ++it) {
|
||||||
// Cast is needed because Map's api and internal storage is different when
|
// Cast is needed because Map's api and internal message_base is different when
|
||||||
// value is enum. For enum, we cannot cast an int to enum. Thus, we have to
|
// value is enum. For enum, we cannot cast an int to enum. Thus, we have to
|
||||||
// copy value. For other types, they have same exposed api type and internal
|
// copy value. For other types, they have same exposed api type and internal
|
||||||
// stored type. We should not introduce value copy for them. We achieve this
|
// stored type. We should not introduce value copy for them. We achieve this
|
||||||
|
@ -50,7 +50,7 @@ namespace internal {
|
|||||||
// uses a tagged pointer to either store the Arena pointer, if there are no
|
// uses a tagged pointer to either store the Arena pointer, if there are no
|
||||||
// unknown fields, or a pointer to a block of memory with both the Arena pointer
|
// unknown fields, or a pointer to a block of memory with both the Arena pointer
|
||||||
// and the UnknownFieldSet, if there are unknown fields. This optimization
|
// and the UnknownFieldSet, if there are unknown fields. This optimization
|
||||||
// allows for "zero-overhead" storage of the Arena pointer, relative to the
|
// allows for "zero-overhead" message_base of the Arena pointer, relative to the
|
||||||
// above baseline implementation.
|
// above baseline implementation.
|
||||||
//
|
//
|
||||||
// The tagged pointer uses the LSB to disambiguate cases, and uses bit 0 == 0 to
|
// The tagged pointer uses the LSB to disambiguate cases, and uses bit 0 == 0 to
|
||||||
|
@ -343,7 +343,7 @@ class RepeatedField final {
|
|||||||
static const size_t kRepHeaderSize;
|
static const size_t kRepHeaderSize;
|
||||||
|
|
||||||
// If total_size_ == 0 this points to an Arena otherwise it points to the
|
// If total_size_ == 0 this points to an Arena otherwise it points to the
|
||||||
// elements member of a Rep struct. Using this invariant allows the storage of
|
// elements member of a Rep struct. Using this invariant allows the message_base of
|
||||||
// the arena pointer without an extra allocation in the constructor.
|
// the arena pointer without an extra allocation in the constructor.
|
||||||
void* arena_or_elements_;
|
void* arena_or_elements_;
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ class RepeatedField final {
|
|||||||
// Copy the elements of |from| into |to|.
|
// Copy the elements of |from| into |to|.
|
||||||
void CopyArray(Element* to, const Element* from, int size);
|
void CopyArray(Element* to, const Element* from, int size);
|
||||||
|
|
||||||
// Internal helper to delete all elements and deallocate the storage.
|
// Internal helper to delete all elements and deallocate the message_base.
|
||||||
// If Element has a trivial destructor (for example, if it's a fundamental
|
// If Element has a trivial destructor (for example, if it's a fundamental
|
||||||
// type, like int32), the loop will be removed by the optimizer.
|
// type, like int32), the loop will be removed by the optimizer.
|
||||||
void InternalDeallocate(Rep* rep, int size) {
|
void InternalDeallocate(Rep* rep, int size) {
|
||||||
@ -1571,7 +1571,7 @@ void RepeatedField<Element>::Reserve(int new_size) {
|
|||||||
arena_or_elements_ = new_rep->elements;
|
arena_or_elements_ = new_rep->elements;
|
||||||
// Invoke placement-new on newly allocated elements. We shouldn't have to do
|
// Invoke placement-new on newly allocated elements. We shouldn't have to do
|
||||||
// this, since Element is supposed to be POD, but a previous version of this
|
// this, since Element is supposed to be POD, but a previous version of this
|
||||||
// code allocated storage with "new Element[size]" and some code uses
|
// code allocated message_base with "new Element[size]" and some code uses
|
||||||
// RepeatedField with non-POD types, relying on constructor invocation. If
|
// RepeatedField with non-POD types, relying on constructor invocation. If
|
||||||
// Element has a trivial constructor (e.g., int32), gcc (tested with -O2)
|
// Element has a trivial constructor (e.g., int32), gcc (tested with -O2)
|
||||||
// completely removes this loop because the loop body is empty, so this has no
|
// completely removes this loop because the loop body is empty, so this has no
|
||||||
|
@ -63,7 +63,7 @@ template <class T> struct RemoveConst<const T> : RemoveConst<T> {};
|
|||||||
// operator[] for lookup is discouraged for several reasons:
|
// operator[] for lookup is discouraged for several reasons:
|
||||||
// * It has a side-effect of inserting missing keys
|
// * It has a side-effect of inserting missing keys
|
||||||
// * It is not thread-safe (even when it is not inserting, it can still
|
// * It is not thread-safe (even when it is not inserting, it can still
|
||||||
// choose to resize the underlying storage)
|
// choose to resize the underlying message_base)
|
||||||
// * It invalidates iterators (when it chooses to resize)
|
// * It invalidates iterators (when it chooses to resize)
|
||||||
// * It default constructs a value object even if it doesn't need to
|
// * It default constructs a value object even if it doesn't need to
|
||||||
//
|
//
|
||||||
|
@ -1503,7 +1503,7 @@ class ThreadWithParam : public ThreadWithParamBase {
|
|||||||
ThreadWithParam& operator=(const ThreadWithParam&) = delete;
|
ThreadWithParam& operator=(const ThreadWithParam&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements thread-local storage on Windows systems.
|
// Implements thread-local message_base on Windows systems.
|
||||||
//
|
//
|
||||||
// // Thread 1
|
// // Thread 1
|
||||||
// ThreadLocal<int> tl(100); // 100 is the default value for each thread.
|
// ThreadLocal<int> tl(100); // 100 is the default value for each thread.
|
||||||
@ -1724,7 +1724,7 @@ extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
|
|||||||
delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
|
delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements thread-local storage on pthreads-based systems.
|
// Implements thread-local message_base on pthreads-based systems.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class GTEST_API_ ThreadLocal {
|
class GTEST_API_ ThreadLocal {
|
||||||
public:
|
public:
|
||||||
|
@ -423,7 +423,7 @@ public:
|
|||||||
#endif // SI_SUPPORT_IOSTREAMS
|
#endif // SI_SUPPORT_IOSTREAMS
|
||||||
|
|
||||||
/** Characterset conversion utility class to convert strings to the
|
/** Characterset conversion utility class to convert strings to the
|
||||||
same format as is used for the storage.
|
same format as is used for the message_base.
|
||||||
*/
|
*/
|
||||||
class Converter : private SI_CONVERTER {
|
class Converter : private SI_CONVERTER {
|
||||||
public:
|
public:
|
||||||
@ -480,14 +480,14 @@ public:
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/** @{ @name Settings */
|
/** @{ @name Settings */
|
||||||
|
|
||||||
/** Set the storage format of the INI data. This affects both the loading
|
/** Set the message_base format of the INI data. This affects both the loading
|
||||||
and saving of the INI data using all of the Load/Save API functions.
|
and saving of the INI data using all of the Load/Save API functions.
|
||||||
This value cannot be changed after any INI data has been loaded.
|
This value cannot be changed after any INI data has been loaded.
|
||||||
|
|
||||||
If the file is not set to Unicode (UTF-8), then the data encoding is
|
If the file is not set to Unicode (UTF-8), then the data encoding is
|
||||||
assumed to be the OS native encoding. This encoding is the system
|
assumed to be the OS native encoding. This encoding is the system
|
||||||
locale on Linux/Unix and the legacy MBCS encoding on Windows NT/2K/XP.
|
locale on Linux/Unix and the legacy MBCS encoding on Windows NT/2K/XP.
|
||||||
If the storage format is set to Unicode then the file will be loaded
|
If the message_base format is set to Unicode then the file will be loaded
|
||||||
as UTF-8 encoded data regardless of the native file encoding. If
|
as UTF-8 encoded data regardless of the native file encoding. If
|
||||||
SI_CHAR == char then all of the char* parameters take and return UTF-8
|
SI_CHAR == char then all of the char* parameters take and return UTF-8
|
||||||
encoded data regardless of the system locale.
|
encoded data regardless of the system locale.
|
||||||
@ -498,7 +498,7 @@ public:
|
|||||||
if (!m_pData) m_bStoreIsUtf8 = a_bIsUtf8;
|
if (!m_pData) m_bStoreIsUtf8 = a_bIsUtf8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the storage format of the INI data. */
|
/** Get the message_base format of the INI data. */
|
||||||
bool IsUnicode() const { return m_bStoreIsUtf8; }
|
bool IsUnicode() const { return m_bStoreIsUtf8; }
|
||||||
|
|
||||||
/** Should multiple identical keys be permitted in the file. If set to false
|
/** Should multiple identical keys be permitted in the file. If set to false
|
||||||
@ -523,7 +523,7 @@ public:
|
|||||||
m_bAllowMultiKey = a_bAllowMultiKey;
|
m_bAllowMultiKey = a_bAllowMultiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the storage format of the INI data. */
|
/** Get the message_base format of the INI data. */
|
||||||
bool IsMultiKey() const { return m_bAllowMultiKey; }
|
bool IsMultiKey() const { return m_bAllowMultiKey; }
|
||||||
|
|
||||||
/** Should data values be permitted to span multiple lines in the file. If
|
/** Should data values be permitted to span multiple lines in the file. If
|
||||||
@ -2904,10 +2904,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate the number of SI_CHAR required for converting the input
|
/** Calculate the number of SI_CHAR required for converting the input
|
||||||
* from the storage format. The storage format is always UTF-8 or MBCS.
|
* from the message_base format. The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData Data in storage format to be converted to SI_CHAR.
|
* @param a_pInputData Data in message_base format to be converted to SI_CHAR.
|
||||||
* @param a_uInputDataLen Length of storage format data in bytes. This
|
* @param a_uInputDataLen Length of message_base format data in bytes. This
|
||||||
* must be the actual length of the data, including
|
* must be the actual length of the data, including
|
||||||
* NULL byte if NULL terminated string is required.
|
* NULL byte if NULL terminated string is required.
|
||||||
* @return Number of SI_CHAR required by the string when
|
* @return Number of SI_CHAR required by the string when
|
||||||
@ -2927,11 +2927,11 @@ public:
|
|||||||
return a_uInputDataLen;
|
return a_uInputDataLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the input string from the storage format to SI_CHAR.
|
/** Convert the input string from the message_base format to SI_CHAR.
|
||||||
* The storage format is always UTF-8 or MBCS.
|
* The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData Data in storage format to be converted to SI_CHAR.
|
* @param a_pInputData Data in message_base format to be converted to SI_CHAR.
|
||||||
* @param a_uInputDataLen Length of storage format data in bytes. This
|
* @param a_uInputDataLen Length of message_base format data in bytes. This
|
||||||
* must be the actual length of the data, including
|
* must be the actual length of the data, including
|
||||||
* NULL byte if NULL terminated string is required.
|
* NULL byte if NULL terminated string is required.
|
||||||
* @param a_pOutputData Pointer to the output buffer to received the
|
* @param a_pOutputData Pointer to the output buffer to received the
|
||||||
@ -2954,13 +2954,13 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate the number of char required by the storage format of this
|
/** Calculate the number of char required by the message_base format of this
|
||||||
* data. The storage format is always UTF-8 or MBCS.
|
* data. The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData NULL terminated string to calculate the number of
|
* @param a_pInputData NULL terminated string to calculate the number of
|
||||||
* bytes required to be converted to storage format.
|
* bytes required to be converted to message_base format.
|
||||||
* @return Number of bytes required by the string when
|
* @return Number of bytes required by the string when
|
||||||
* converted to storage format. This size always
|
* converted to message_base format. This size always
|
||||||
* includes space for the terminating NULL character.
|
* includes space for the terminating NULL character.
|
||||||
* @return -1 cast to size_t on a conversion error.
|
* @return -1 cast to size_t on a conversion error.
|
||||||
*/
|
*/
|
||||||
@ -2971,8 +2971,8 @@ public:
|
|||||||
return strlen((const char *)a_pInputData) + 1;
|
return strlen((const char *)a_pInputData) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the input string to the storage format of this data.
|
/** Convert the input string to the message_base format of this data.
|
||||||
* The storage format is always UTF-8 or MBCS.
|
* The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData NULL terminated source string to convert. All of
|
* @param a_pInputData NULL terminated source string to convert. All of
|
||||||
* the data will be converted including the
|
* the data will be converted including the
|
||||||
@ -3033,10 +3033,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate the number of SI_CHAR required for converting the input
|
/** Calculate the number of SI_CHAR required for converting the input
|
||||||
* from the storage format. The storage format is always UTF-8 or MBCS.
|
* from the message_base format. The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData Data in storage format to be converted to SI_CHAR.
|
* @param a_pInputData Data in message_base format to be converted to SI_CHAR.
|
||||||
* @param a_uInputDataLen Length of storage format data in bytes. This
|
* @param a_uInputDataLen Length of message_base format data in bytes. This
|
||||||
* must be the actual length of the data, including
|
* must be the actual length of the data, including
|
||||||
* NULL byte if NULL terminated string is required.
|
* NULL byte if NULL terminated string is required.
|
||||||
* @return Number of SI_CHAR required by the string when
|
* @return Number of SI_CHAR required by the string when
|
||||||
@ -3069,11 +3069,11 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the input string from the storage format to SI_CHAR.
|
/** Convert the input string from the message_base format to SI_CHAR.
|
||||||
* The storage format is always UTF-8 or MBCS.
|
* The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData Data in storage format to be converted to SI_CHAR.
|
* @param a_pInputData Data in message_base format to be converted to SI_CHAR.
|
||||||
* @param a_uInputDataLen Length of storage format data in bytes. This
|
* @param a_uInputDataLen Length of message_base format data in bytes. This
|
||||||
* must be the actual length of the data, including
|
* must be the actual length of the data, including
|
||||||
* NULL byte if NULL terminated string is required.
|
* NULL byte if NULL terminated string is required.
|
||||||
* @param a_pOutputData Pointer to the output buffer to received the
|
* @param a_pOutputData Pointer to the output buffer to received the
|
||||||
@ -3119,13 +3119,13 @@ public:
|
|||||||
return retval != (size_t)(-1);
|
return retval != (size_t)(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate the number of char required by the storage format of this
|
/** Calculate the number of char required by the message_base format of this
|
||||||
* data. The storage format is always UTF-8 or MBCS.
|
* data. The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData NULL terminated string to calculate the number of
|
* @param a_pInputData NULL terminated string to calculate the number of
|
||||||
* bytes required to be converted to storage format.
|
* bytes required to be converted to message_base format.
|
||||||
* @return Number of bytes required by the string when
|
* @return Number of bytes required by the string when
|
||||||
* converted to storage format. This size always
|
* converted to message_base format. This size always
|
||||||
* includes space for the terminating NULL character.
|
* includes space for the terminating NULL character.
|
||||||
* @return -1 cast to size_t on a conversion error.
|
* @return -1 cast to size_t on a conversion error.
|
||||||
*/
|
*/
|
||||||
@ -3149,8 +3149,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the input string to the storage format of this data.
|
/** Convert the input string to the message_base format of this data.
|
||||||
* The storage format is always UTF-8 or MBCS.
|
* The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData NULL terminated source string to convert. All of
|
* @param a_pInputData NULL terminated source string to convert. All of
|
||||||
* the data will be converted including the
|
* the data will be converted including the
|
||||||
@ -3244,10 +3244,10 @@ public:
|
|||||||
~SI_ConvertW() { if (m_pConverter) ucnv_close(m_pConverter); }
|
~SI_ConvertW() { if (m_pConverter) ucnv_close(m_pConverter); }
|
||||||
|
|
||||||
/** Calculate the number of UChar required for converting the input
|
/** Calculate the number of UChar required for converting the input
|
||||||
* from the storage format. The storage format is always UTF-8 or MBCS.
|
* from the message_base format. The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData Data in storage format to be converted to UChar.
|
* @param a_pInputData Data in message_base format to be converted to UChar.
|
||||||
* @param a_uInputDataLen Length of storage format data in bytes. This
|
* @param a_uInputDataLen Length of message_base format data in bytes. This
|
||||||
* must be the actual length of the data, including
|
* must be the actual length of the data, including
|
||||||
* NULL byte if NULL terminated string is required.
|
* NULL byte if NULL terminated string is required.
|
||||||
* @return Number of UChar required by the string when
|
* @return Number of UChar required by the string when
|
||||||
@ -3282,11 +3282,11 @@ public:
|
|||||||
return (size_t) nLen;
|
return (size_t) nLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the input string from the storage format to UChar.
|
/** Convert the input string from the message_base format to UChar.
|
||||||
* The storage format is always UTF-8 or MBCS.
|
* The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData Data in storage format to be converted to UChar.
|
* @param a_pInputData Data in message_base format to be converted to UChar.
|
||||||
* @param a_uInputDataLen Length of storage format data in bytes. This
|
* @param a_uInputDataLen Length of message_base format data in bytes. This
|
||||||
* must be the actual length of the data, including
|
* must be the actual length of the data, including
|
||||||
* NULL byte if NULL terminated string is required.
|
* NULL byte if NULL terminated string is required.
|
||||||
* @param a_pOutputData Pointer to the output buffer to received the
|
* @param a_pOutputData Pointer to the output buffer to received the
|
||||||
@ -3322,13 +3322,13 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate the number of char required by the storage format of this
|
/** Calculate the number of char required by the message_base format of this
|
||||||
* data. The storage format is always UTF-8 or MBCS.
|
* data. The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData NULL terminated string to calculate the number of
|
* @param a_pInputData NULL terminated string to calculate the number of
|
||||||
* bytes required to be converted to storage format.
|
* bytes required to be converted to message_base format.
|
||||||
* @return Number of bytes required by the string when
|
* @return Number of bytes required by the string when
|
||||||
* converted to storage format. This size always
|
* converted to message_base format. This size always
|
||||||
* includes space for the terminating NULL character.
|
* includes space for the terminating NULL character.
|
||||||
* @return -1 cast to size_t on a conversion error.
|
* @return -1 cast to size_t on a conversion error.
|
||||||
*/
|
*/
|
||||||
@ -3355,8 +3355,8 @@ public:
|
|||||||
return (size_t) nLen + 1;
|
return (size_t) nLen + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the input string to the storage format of this data.
|
/** Convert the input string to the message_base format of this data.
|
||||||
* The storage format is always UTF-8 or MBCS.
|
* The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData NULL terminated source string to convert. All of
|
* @param a_pInputData NULL terminated source string to convert. All of
|
||||||
* the data will be converted including the
|
* the data will be converted including the
|
||||||
@ -3465,10 +3465,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate the number of SI_CHAR required for converting the input
|
/** Calculate the number of SI_CHAR required for converting the input
|
||||||
* from the storage format. The storage format is always UTF-8 or MBCS.
|
* from the message_base format. The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData Data in storage format to be converted to SI_CHAR.
|
* @param a_pInputData Data in message_base format to be converted to SI_CHAR.
|
||||||
* @param a_uInputDataLen Length of storage format data in bytes. This
|
* @param a_uInputDataLen Length of message_base format data in bytes. This
|
||||||
* must be the actual length of the data, including
|
* must be the actual length of the data, including
|
||||||
* NULL byte if NULL terminated string is required.
|
* NULL byte if NULL terminated string is required.
|
||||||
* @return Number of SI_CHAR required by the string when
|
* @return Number of SI_CHAR required by the string when
|
||||||
@ -3490,11 +3490,11 @@ public:
|
|||||||
return (size_t)(retval > 0 ? retval : -1);
|
return (size_t)(retval > 0 ? retval : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the input string from the storage format to SI_CHAR.
|
/** Convert the input string from the message_base format to SI_CHAR.
|
||||||
* The storage format is always UTF-8 or MBCS.
|
* The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData Data in storage format to be converted to SI_CHAR.
|
* @param a_pInputData Data in message_base format to be converted to SI_CHAR.
|
||||||
* @param a_uInputDataLen Length of storage format data in bytes. This
|
* @param a_uInputDataLen Length of message_base format data in bytes. This
|
||||||
* must be the actual length of the data, including
|
* must be the actual length of the data, including
|
||||||
* NULL byte if NULL terminated string is required.
|
* NULL byte if NULL terminated string is required.
|
||||||
* @param a_pOutputData Pointer to the output buffer to received the
|
* @param a_pOutputData Pointer to the output buffer to received the
|
||||||
@ -3516,13 +3516,13 @@ public:
|
|||||||
return (nSize > 0);
|
return (nSize > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate the number of char required by the storage format of this
|
/** Calculate the number of char required by the message_base format of this
|
||||||
* data. The storage format is always UTF-8.
|
* data. The message_base format is always UTF-8.
|
||||||
*
|
*
|
||||||
* @param a_pInputData NULL terminated string to calculate the number of
|
* @param a_pInputData NULL terminated string to calculate the number of
|
||||||
* bytes required to be converted to storage format.
|
* bytes required to be converted to message_base format.
|
||||||
* @return Number of bytes required by the string when
|
* @return Number of bytes required by the string when
|
||||||
* converted to storage format. This size always
|
* converted to message_base format. This size always
|
||||||
* includes space for the terminating NULL character.
|
* includes space for the terminating NULL character.
|
||||||
* @return -1 cast to size_t on a conversion error.
|
* @return -1 cast to size_t on a conversion error.
|
||||||
*/
|
*/
|
||||||
@ -3536,8 +3536,8 @@ public:
|
|||||||
return (size_t) (retval > 0 ? retval : -1);
|
return (size_t) (retval > 0 ? retval : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the input string to the storage format of this data.
|
/** Convert the input string to the message_base format of this data.
|
||||||
* The storage format is always UTF-8 or MBCS.
|
* The message_base format is always UTF-8 or MBCS.
|
||||||
*
|
*
|
||||||
* @param a_pInputData NULL terminated source string to convert. All of
|
* @param a_pInputData NULL terminated source string to convert. All of
|
||||||
* the data will be converted including the
|
* the data will be converted including the
|
||||||
|
@ -143,7 +143,7 @@ struct evbuffer_iovec {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate storage for a new evbuffer.
|
Allocate message_base for a new evbuffer.
|
||||||
|
|
||||||
@return a pointer to a newly allocated evbuffer struct, or NULL if an error
|
@return a pointer to a newly allocated evbuffer struct, or NULL if an error
|
||||||
occurred
|
occurred
|
||||||
@ -151,7 +151,7 @@ struct evbuffer_iovec {
|
|||||||
EVENT2_EXPORT_SYMBOL
|
EVENT2_EXPORT_SYMBOL
|
||||||
struct evbuffer *evbuffer_new(void);
|
struct evbuffer *evbuffer_new(void);
|
||||||
/**
|
/**
|
||||||
Deallocate storage for an evbuffer.
|
Deallocate message_base for an evbuffer.
|
||||||
|
|
||||||
@param buf pointer to the evbuffer to be freed
|
@param buf pointer to the evbuffer to be freed
|
||||||
*/
|
*/
|
||||||
|
@ -316,7 +316,7 @@ EVENT2_EXPORT_SYMBOL
|
|||||||
int bufferevent_get_priority(const struct bufferevent *bufev);
|
int bufferevent_get_priority(const struct bufferevent *bufev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deallocate the storage associated with a bufferevent structure.
|
Deallocate the message_base associated with a bufferevent structure.
|
||||||
|
|
||||||
If there is pending data to write on the bufferevent, it probably won't be
|
If there is pending data to write on the bufferevent, it probably won't be
|
||||||
flushed before the bufferevent is freed.
|
flushed before the bufferevent is freed.
|
||||||
@ -820,7 +820,7 @@ struct ev_token_bucket_cfg *ev_token_bucket_cfg_new(
|
|||||||
size_t write_rate, size_t write_burst,
|
size_t write_rate, size_t write_burst,
|
||||||
const struct timeval *tick_len);
|
const struct timeval *tick_len);
|
||||||
|
|
||||||
/** Free all storage held in 'cfg'.
|
/** Free all message_base held in 'cfg'.
|
||||||
|
|
||||||
Note: 'cfg' is not currently reference-counted; it is not safe to free it
|
Note: 'cfg' is not currently reference-counted; it is not safe to free it
|
||||||
until no bufferevent is using it.
|
until no bufferevent is using it.
|
||||||
|
@ -107,7 +107,7 @@ struct evthread_lock_callbacks {
|
|||||||
/** Function to allocate and initialize new lock of type 'locktype'.
|
/** Function to allocate and initialize new lock of type 'locktype'.
|
||||||
* Returns NULL on failure. */
|
* Returns NULL on failure. */
|
||||||
void *(*alloc)(unsigned locktype);
|
void *(*alloc)(unsigned locktype);
|
||||||
/** Funtion to release all storage held in 'lock', which was created
|
/** Funtion to release all message_base held in 'lock', which was created
|
||||||
* with type 'locktype'. */
|
* with type 'locktype'. */
|
||||||
void (*free)(void *lock, unsigned locktype);
|
void (*free)(void *lock, unsigned locktype);
|
||||||
/** Acquire an already-allocated lock at 'lock' with mode 'mode'.
|
/** Acquire an already-allocated lock at 'lock' with mode 'mode'.
|
||||||
|
@ -808,7 +808,7 @@ EVENT2_EXPORT_SYMBOL
|
|||||||
int evutil_getaddrinfo(const char *nodename, const char *servname,
|
int evutil_getaddrinfo(const char *nodename, const char *servname,
|
||||||
const struct evutil_addrinfo *hints_in, struct evutil_addrinfo **res);
|
const struct evutil_addrinfo *hints_in, struct evutil_addrinfo **res);
|
||||||
|
|
||||||
/** Release storage allocated by evutil_getaddrinfo or evdns_getaddrinfo. */
|
/** Release message_base allocated by evutil_getaddrinfo or evdns_getaddrinfo. */
|
||||||
EVENT2_EXPORT_SYMBOL
|
EVENT2_EXPORT_SYMBOL
|
||||||
void evutil_freeaddrinfo(struct evutil_addrinfo *ai);
|
void evutil_freeaddrinfo(struct evutil_addrinfo *ai);
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@
|
|||||||
*/
|
*/
|
||||||
#define FIELD_IN_ADD_INDEX (1 << 20)
|
#define FIELD_IN_ADD_INDEX (1 << 20)
|
||||||
#define FIELD_IS_RENAMED (1 << 21) /**< Intern: Field is being renamed */
|
#define FIELD_IS_RENAMED (1 << 21) /**< Intern: Field is being renamed */
|
||||||
#define FIELD_FLAGS_STORAGE_MEDIA 22 /**< Field storage media, bit 22-23 */
|
#define FIELD_FLAGS_STORAGE_MEDIA 22 /**< Field message_base media, bit 22-23 */
|
||||||
#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)
|
#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)
|
||||||
#define FIELD_FLAGS_COLUMN_FORMAT 24 /**< Field column format, bit 24-25 */
|
#define FIELD_FLAGS_COLUMN_FORMAT 24 /**< Field column format, bit 24-25 */
|
||||||
#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
|
#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
|
||||||
@ -232,7 +232,7 @@
|
|||||||
128 /**< Remove all bin logs in the index \
|
128 /**< Remove all bin logs in the index \
|
||||||
and truncate the index, RESET MASTER */
|
and truncate the index, RESET MASTER */
|
||||||
#define REFRESH_ERROR_LOG 256 /**< Rotate only the error log */
|
#define REFRESH_ERROR_LOG 256 /**< Rotate only the error log */
|
||||||
#define REFRESH_ENGINE_LOG 512 /**< Flush all storage engine logs */
|
#define REFRESH_ENGINE_LOG 512 /**< Flush all message_base engine logs */
|
||||||
#define REFRESH_BINARY_LOG 1024 /**< Flush the binary log */
|
#define REFRESH_BINARY_LOG 1024 /**< Flush the binary log */
|
||||||
#define REFRESH_RELAY_LOG 2048 /**< Flush the relay log */
|
#define REFRESH_RELAY_LOG 2048 /**< Flush the relay log */
|
||||||
#define REFRESH_GENERAL_LOG 4096 /**< Flush the general log */
|
#define REFRESH_GENERAL_LOG 4096 /**< Flush the general log */
|
||||||
@ -1009,9 +1009,9 @@ enum mysql_enum_shutdown_level {
|
|||||||
SHUTDOWN_WAIT_TRANSACTIONS = MYSQL_SHUTDOWN_KILLABLE_TRANS,
|
SHUTDOWN_WAIT_TRANSACTIONS = MYSQL_SHUTDOWN_KILLABLE_TRANS,
|
||||||
/** Wait for existing updates to finish (=> no partial MyISAM update) */
|
/** Wait for existing updates to finish (=> no partial MyISAM update) */
|
||||||
SHUTDOWN_WAIT_UPDATES = MYSQL_SHUTDOWN_KILLABLE_UPDATE,
|
SHUTDOWN_WAIT_UPDATES = MYSQL_SHUTDOWN_KILLABLE_UPDATE,
|
||||||
/** Flush InnoDB buffers and other storage engines' buffers*/
|
/** Flush InnoDB buffers and other message_base engines' buffers*/
|
||||||
SHUTDOWN_WAIT_ALL_BUFFERS = (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1),
|
SHUTDOWN_WAIT_ALL_BUFFERS = (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1),
|
||||||
/** Don't flush InnoDB buffers, flush other storage engines' buffers*/
|
/** Don't flush InnoDB buffers, flush other message_base engines' buffers*/
|
||||||
SHUTDOWN_WAIT_CRITICAL_BUFFERS = (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
|
SHUTDOWN_WAIT_CRITICAL_BUFFERS = (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
|
||||||
/** Query level of the KILL command */
|
/** Query level of the KILL command */
|
||||||
KILL_QUERY = 254,
|
KILL_QUERY = 254,
|
||||||
|
@ -106,7 +106,7 @@ public:
|
|||||||
/// This commits all updates to the database using the connection
|
/// This commits all updates to the database using the connection
|
||||||
/// we were created with since this object was created. This is a
|
/// we were created with since this object was created. This is a
|
||||||
/// no-op if the table isn't stored using a transaction-aware
|
/// no-op if the table isn't stored using a transaction-aware
|
||||||
/// storage engine. See CREATE TABLE in the MySQL manual for
|
/// message_base engine. See CREATE TABLE in the MySQL manual for
|
||||||
/// details.
|
/// details.
|
||||||
void commit();
|
void commit();
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// This abandons all SQL statements made on the connection since
|
/// This abandons all SQL statements made on the connection since
|
||||||
/// this object was created. This only works on tables stored using
|
/// this object was created. This only works on tables stored using
|
||||||
/// a transaction-aware storage engine. See CREATE TABLE in the
|
/// a transaction-aware message_base engine. See CREATE TABLE in the
|
||||||
/// MySQL manual for details.
|
/// MySQL manual for details.
|
||||||
void rollback();
|
void rollback();
|
||||||
|
|
||||||
|
@ -1231,7 +1231,7 @@ public:
|
|||||||
RAPIDJSON_ASSERT(false); // see above note
|
RAPIDJSON_ASSERT(false); // see above note
|
||||||
|
|
||||||
#if RAPIDJSON_HAS_CXX11
|
#if RAPIDJSON_HAS_CXX11
|
||||||
// Use thread-local storage to prevent races between threads.
|
// Use thread-local message_base to prevent races between threads.
|
||||||
// Use static buffer and placement-new to prevent destruction, with
|
// Use static buffer and placement-new to prevent destruction, with
|
||||||
// alignas() to ensure proper alignment.
|
// alignas() to ensure proper alignment.
|
||||||
alignas(GenericValue) thread_local static char buffer[sizeof(GenericValue)];
|
alignas(GenericValue) thread_local static char buffer[sizeof(GenericValue)];
|
||||||
@ -2490,7 +2490,7 @@ typedef GenericValue<UTF8<> > Value;
|
|||||||
//! A document for parsing JSON text as DOM.
|
//! A document for parsing JSON text as DOM.
|
||||||
/*!
|
/*!
|
||||||
\note implements Handler concept
|
\note implements Handler concept
|
||||||
\tparam Encoding Encoding for both parsing and string storage.
|
\tparam Encoding Encoding for both parsing and string message_base.
|
||||||
\tparam Allocator Allocator for allocating memory for the DOM
|
\tparam Allocator Allocator for allocating memory for the DOM
|
||||||
\tparam StackAllocator Allocator for allocating memory for stack during parsing.
|
\tparam StackAllocator Allocator for allocating memory for stack during parsing.
|
||||||
\warning Although GenericDocument inherits from GenericValue, the API does \b not provide any virtual functions, especially no virtual destructor. To avoid memory leaks, do not \c delete a GenericDocument object via a pointer to a GenericValue.
|
\warning Although GenericDocument inherits from GenericValue, the API does \b not provide any virtual functions, especially no virtual destructor. To avoid memory leaks, do not \c delete a GenericDocument object via a pointer to a GenericValue.
|
||||||
|
@ -128,7 +128,7 @@ private:
|
|||||||
// Round up to the next cache line (align the base address)
|
// Round up to the next cache line (align the base address)
|
||||||
std::uintptr_t result = (base + cache_line_alignment) & ~(cache_line_alignment - 1);
|
std::uintptr_t result = (base + cache_line_alignment) & ~(cache_line_alignment - 1);
|
||||||
__TBB_ASSERT((result - base) >= sizeof(std::uintptr_t), "Can`t store a base pointer to the header");
|
__TBB_ASSERT((result - base) >= sizeof(std::uintptr_t), "Can`t store a base pointer to the header");
|
||||||
__TBB_ASSERT(space - (result - base) >= bytes, "Not enough space for the storage");
|
__TBB_ASSERT(space - (result - base) >= bytes, "Not enough space for the message_base");
|
||||||
|
|
||||||
// Record where block actually starts.
|
// Record where block actually starts.
|
||||||
(reinterpret_cast<std::uintptr_t*>(result))[-1] = base;
|
(reinterpret_cast<std::uintptr_t*>(result))[-1] = base;
|
||||||
|
@ -95,7 +95,7 @@ public:
|
|||||||
|
|
||||||
template <typename F>
|
template <typename F>
|
||||||
void run_once(F&& f) {
|
void run_once(F&& f) {
|
||||||
__TBB_ASSERT(!m_is_ready.load(std::memory_order_relaxed), "storage with task_arena and wait_context is already initialized");
|
__TBB_ASSERT(!m_is_ready.load(std::memory_order_relaxed), "message_base with task_arena and wait_context is already initialized");
|
||||||
// Initialize internal state
|
// Initialize internal state
|
||||||
new(&m_storage) storage_t();
|
new(&m_storage) storage_t();
|
||||||
m_storage.m_arena.execute([&] {
|
m_storage.m_arena.execute([&] {
|
||||||
|
@ -27,7 +27,7 @@ namespace detail {
|
|||||||
namespace d1 {
|
namespace d1 {
|
||||||
/** \name combinable **/
|
/** \name combinable **/
|
||||||
//@{
|
//@{
|
||||||
//! Thread-local storage with optional reduction
|
//! Thread-local message_base with optional reduction
|
||||||
/** @ingroup containers */
|
/** @ingroup containers */
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class combinable {
|
class combinable {
|
||||||
|
@ -83,7 +83,7 @@ private:
|
|||||||
value_function_type my_value_function;
|
value_function_type my_value_function;
|
||||||
aggregator_type my_aggregator;
|
aggregator_type my_aggregator;
|
||||||
|
|
||||||
storage_map_type my_storage_map; // storage map for used objects
|
storage_map_type my_storage_map; // message_base map for used objects
|
||||||
history_list_type my_history_list; // history list for unused objects
|
history_list_type my_history_list; // history list for unused objects
|
||||||
const std::size_t my_history_list_capacity; // history list's allowed capacity
|
const std::size_t my_history_list_capacity; // history list's allowed capacity
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Value type for storage map in concurrent LRU cache
|
// Value type for message_base map in concurrent LRU cache
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
template<typename KeyT, typename ValT, typename KeyToValFunctorT>
|
template<typename KeyT, typename ValT, typename KeyToValFunctorT>
|
||||||
|
@ -651,7 +651,7 @@ struct construct_by_args: no_assign {
|
|||||||
construct_by_args( P&& ... args ) : pack(std::forward<P>(args)...) {}
|
construct_by_args( P&& ... args ) : pack(std::forward<P>(args)...) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// storage for initialization function pointer
|
// message_base for initialization function pointer
|
||||||
// TODO: consider removing the template parameter T here and in callback_leaf
|
// TODO: consider removing the template parameter T here and in callback_leaf
|
||||||
class callback_base {
|
class callback_base {
|
||||||
public:
|
public:
|
||||||
@ -734,7 +734,7 @@ template <typename T> using is_callable_no_args = supports<T, has_empty_braces_o
|
|||||||
- thread-local copies do not move (during lifetime, and excepting clear()) so the address of a copy is invariant.
|
- thread-local copies do not move (during lifetime, and excepting clear()) so the address of a copy is invariant.
|
||||||
- the contained objects need not have operator=() defined if combine is not used.
|
- the contained objects need not have operator=() defined if combine is not used.
|
||||||
- enumerable_thread_specific containers may be copy-constructed or assigned.
|
- enumerable_thread_specific containers may be copy-constructed or assigned.
|
||||||
- thread-local copies can be managed by hash-table, or can be accessed via TLS storage for speed.
|
- thread-local copies can be managed by hash-table, or can be accessed via TLS message_base for speed.
|
||||||
- outside of parallel contexts, the contents of all thread-local copies are accessible by iterator or using combine or combine_each methods
|
- outside of parallel contexts, the contents of all thread-local copies are accessible by iterator or using combine or combine_each methods
|
||||||
|
|
||||||
@par Segmented iterator
|
@par Segmented iterator
|
||||||
@ -932,7 +932,7 @@ private:
|
|||||||
using std::swap;
|
using std::swap;
|
||||||
__TBB_ASSERT( this!=&other, nullptr);
|
__TBB_ASSERT( this!=&other, nullptr);
|
||||||
swap(my_construct_callback, other.my_construct_callback);
|
swap(my_construct_callback, other.my_construct_callback);
|
||||||
// concurrent_vector::swap() preserves storage space,
|
// concurrent_vector::swap() preserves message_base space,
|
||||||
// so addresses to the vector kept in ETS hash table remain valid.
|
// so addresses to the vector kept in ETS hash table remain valid.
|
||||||
swap(my_locals, other.my_locals);
|
swap(my_locals, other.my_locals);
|
||||||
this->ets_base<ETS_key_type>::table_swap(other);
|
this->ets_base<ETS_key_type>::table_swap(other);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user