开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (7)
标签 (4)
master
gh-pages
dependabot/npm_and_yarn/projects/JavaScript/elliptic-6.5.3
dependabot/npm_and_yarn/projects/JavaScript/npm-6.14.6
dependabot/npm_and_yarn/projects/JavaScript/acorn-7.3.1
feature-Swift
feature-CSharp7
1.3.0.0
1.2.0.0
1.1.0.0
1.0.0.0
master
分支 (7)
标签 (4)
master
gh-pages
dependabot/npm_and_yarn/projects/JavaScript/elliptic-6.5.3
dependabot/npm_and_yarn/projects/JavaScript/npm-6.14.6
dependabot/npm_and_yarn/projects/JavaScript/acorn-7.3.1
feature-Swift
feature-CSharp7
1.3.0.0
1.2.0.0
1.1.0.0
1.0.0.0
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (7)
标签 (4)
master
gh-pages
dependabot/npm_and_yarn/projects/JavaScript/elliptic-6.5.3
dependabot/npm_and_yarn/projects/JavaScript/npm-6.14.6
dependabot/npm_and_yarn/projects/JavaScript/acorn-7.3.1
feature-Swift
feature-CSharp7
1.3.0.0
1.2.0.0
1.1.0.0
1.0.0.0
print.cpp 8.40 KB
一键复制 编辑 原始数据 按行查看 历史
Ivan Shynkarenka 提交于 2018年12月25日 05:02 +08:00 . Refactoring
/*!
\file print.cpp
\brief Fast Binary Encoding print example
\author Ivan Shynkarenka
\date 18.04.2018
\copyright MIT License
*/
#include "../proto/test.h"
#include <iostream>
const char* f1 = "ABC";
const char* f2 = "test";
int main(int argc, char** argv)
{
std::cout << test::StructSimple() << std::endl << std::endl;
std::cout << test::StructOptional() << std::endl << std::endl;
std::cout << test::StructNested() << std::endl << std::endl;
// Print bytes struct
test::StructBytes struct_bytes;
struct_bytes.f1.assign((const uint8_t*)f1, (const uint8_t*)f1 + strlen(f1));
struct_bytes.f2.emplace();
struct_bytes.f2.value().assign((const uint8_t*)f2, (const uint8_t*)f2 + strlen(f2));
std::cout << struct_bytes << std::endl << std::endl;
// Print array struct
test::StructArray struct_array;
struct_array.f1[0] = (uint8_t)48;
struct_array.f1[1] = (uint8_t)65;
struct_array.f2[0] = (uint8_t)97;
struct_array.f2[1] = std::nullopt;
struct_array.f3[0] = std::vector<uint8_t>(3, 48);
struct_array.f3[1] = std::vector<uint8_t>(3, 65);
struct_array.f4[0] = std::vector<uint8_t>(3, 97);
struct_array.f4[1] = std::nullopt;
struct_array.f5[0] = test::EnumSimple::ENUM_VALUE_1;
struct_array.f5[1] = test::EnumSimple::ENUM_VALUE_2;
struct_array.f6[0] = test::EnumSimple::ENUM_VALUE_1;
struct_array.f6[1] = std::nullopt;
struct_array.f7[0] = test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2;
struct_array.f7[1] = test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2 | test::FlagsSimple::FLAG_VALUE_3;
struct_array.f8[0] = test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2;
struct_array.f8[1] = std::nullopt;
struct_array.f9[0] = test::StructSimple();
struct_array.f9[1] = test::StructSimple();
struct_array.f10[0] = test::StructSimple();
struct_array.f10[1] = std::nullopt;
std::cout << struct_array << std::endl << std::endl;
// Print vector struct
test::StructVector struct_vector;
struct_vector.f1.emplace_back((uint8_t)48);
struct_vector.f1.emplace_back((uint8_t)65);
struct_vector.f2.emplace_back((uint8_t)97);
struct_vector.f2.emplace_back(std::nullopt);
struct_vector.f3.emplace_back(std::vector<uint8_t>(3, 48));
struct_vector.f3.emplace_back(std::vector<uint8_t>(3, 65));
struct_vector.f4.emplace_back(std::vector<uint8_t>(3, 97));
struct_vector.f4.emplace_back(std::nullopt);
struct_vector.f5.emplace_back(test::EnumSimple::ENUM_VALUE_1);
struct_vector.f5.emplace_back(test::EnumSimple::ENUM_VALUE_2);
struct_vector.f6.emplace_back(test::EnumSimple::ENUM_VALUE_1);
struct_vector.f6.emplace_back(std::nullopt);
struct_vector.f7.emplace_back(test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_vector.f7.emplace_back(test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2 | test::FlagsSimple::FLAG_VALUE_3);
struct_vector.f8.emplace_back(test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_vector.f8.emplace_back(std::nullopt);
struct_vector.f9.emplace_back(test::StructSimple());
struct_vector.f9.emplace_back(test::StructSimple());
struct_vector.f10.emplace_back(test::StructSimple());
struct_vector.f10.emplace_back(std::nullopt);
std::cout << struct_vector << std::endl << std::endl;
// Print list struct
test::StructList struct_list;
struct_list.f1.emplace_back((uint8_t)48);
struct_list.f1.emplace_back((uint8_t)65);
struct_list.f2.emplace_back((uint8_t)97);
struct_list.f2.emplace_back(std::nullopt);
struct_list.f3.emplace_back(std::vector<uint8_t>(3, 48));
struct_list.f3.emplace_back(std::vector<uint8_t>(3, 65));
struct_list.f4.emplace_back(std::vector<uint8_t>(3, 97));
struct_list.f4.emplace_back(std::nullopt);
struct_list.f5.emplace_back(test::EnumSimple::ENUM_VALUE_1);
struct_list.f5.emplace_back(test::EnumSimple::ENUM_VALUE_2);
struct_list.f6.emplace_back(test::EnumSimple::ENUM_VALUE_1);
struct_list.f6.emplace_back(std::nullopt);
struct_list.f7.emplace_back(test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_list.f7.emplace_back(test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2 | test::FlagsSimple::FLAG_VALUE_3);
struct_list.f8.emplace_back(test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_list.f8.emplace_back(std::nullopt);
struct_list.f9.emplace_back(test::StructSimple());
struct_list.f9.emplace_back(test::StructSimple());
struct_list.f10.emplace_back(test::StructSimple());
struct_list.f10.emplace_back(std::nullopt);
std::cout << struct_list << std::endl << std::endl;
// Print set struct
test::StructSet struct_set;
struct_set.f1.emplace((uint8_t)48);
struct_set.f1.emplace((uint8_t)65);
struct_set.f1.emplace((uint8_t)97);
struct_set.f2.emplace(test::EnumSimple::ENUM_VALUE_1);
struct_set.f2.emplace(test::EnumSimple::ENUM_VALUE_2);
struct_set.f3.emplace(test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_set.f3.emplace(test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2 | test::FlagsSimple::FLAG_VALUE_3);
test::StructSimple s1;
s1.id = 48;
struct_set.f4.emplace(s1);
test::StructSimple s2;
s2.id = 65;
struct_set.f4.emplace(s2);
std::cout << struct_set << std::endl << std::endl;
// Print map struct
test::StructMap struct_map;
struct_map.f1.emplace(10, (uint8_t)48);
struct_map.f1.emplace(20, (uint8_t)65);
struct_map.f2.emplace(10, (uint8_t)97);
struct_map.f2.emplace(20, std::nullopt);
struct_map.f3.emplace(10, std::vector<uint8_t>(3, 48));
struct_map.f3.emplace(20, std::vector<uint8_t>(3, 65));
struct_map.f4.emplace(10, std::vector<uint8_t>(3, 97));
struct_map.f4.emplace(20, std::nullopt);
struct_map.f5.emplace(10, test::EnumSimple::ENUM_VALUE_1);
struct_map.f5.emplace(20, test::EnumSimple::ENUM_VALUE_2);
struct_map.f6.emplace(10, test::EnumSimple::ENUM_VALUE_1);
struct_map.f6.emplace(20, std::nullopt);
struct_map.f7.emplace(10, test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_map.f7.emplace(20, test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2 | test::FlagsSimple::FLAG_VALUE_3);
struct_map.f8.emplace(10, test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_map.f8.emplace(20, std::nullopt);
s1.id = 48;
struct_map.f9.emplace(10, s1);
s2.id = 65;
struct_map.f9.emplace(20, s2);
struct_map.f10.emplace(10, s1);
struct_map.f10.emplace(20, std::nullopt);
std::cout << struct_map << std::endl << std::endl;
// Print hash struct
test::StructHash struct_hash;
struct_hash.f1.emplace("10", (uint8_t)48);
struct_hash.f1.emplace("20", (uint8_t)65);
struct_hash.f2.emplace("10", (uint8_t)97);
struct_hash.f2.emplace("20", std::nullopt);
struct_hash.f3.emplace("10", std::vector<uint8_t>(3, 48));
struct_hash.f3.emplace("20", std::vector<uint8_t>(3, 65));
struct_hash.f4.emplace("10", std::vector<uint8_t>(3, 97));
struct_hash.f4.emplace("20", std::nullopt);
struct_hash.f5.emplace("10", test::EnumSimple::ENUM_VALUE_1);
struct_hash.f5.emplace("20", test::EnumSimple::ENUM_VALUE_2);
struct_hash.f6.emplace("10", test::EnumSimple::ENUM_VALUE_1);
struct_hash.f6.emplace("20", std::nullopt);
struct_hash.f7.emplace("10", test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_hash.f7.emplace("20", test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2 | test::FlagsSimple::FLAG_VALUE_3);
struct_hash.f8.emplace("10", test::FlagsSimple::FLAG_VALUE_1 | test::FlagsSimple::FLAG_VALUE_2);
struct_hash.f8.emplace("20", std::nullopt);
s1.id = 48;
struct_hash.f9.emplace("10", s1);
s2.id = 65;
struct_hash.f9.emplace("20", s2);
struct_hash.f10.emplace("10", s1);
struct_hash.f10.emplace("20", std::nullopt);
std::cout << struct_hash << std::endl << std::endl;
// Print extended hash struct
test::StructHashEx struct_hashex;
s1.id = 48;
struct_hashex.f1.emplace(s1, test::StructNested());
s2.id = 65;
struct_hashex.f1.emplace(s2, test::StructNested());
struct_hashex.f2.emplace(s1, test::StructNested());
struct_hashex.f2.emplace(s2, std::nullopt);
std::cout << struct_hashex << std::endl << std::endl;
return 0;
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

暂无描述
暂无标签
MIT
使用 MIT 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/damone/FastBinaryEncoding.git
git@gitee.com:damone/FastBinaryEncoding.git
damone
FastBinaryEncoding
FastBinaryEncoding
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /