Skip to content

Instantly share code, notes, and snippets.

View changrui0608's full-sized avatar

CHANG Rui changrui0608

  • 10:55 (UTC +08:00)
View GitHub Profile
@changrui0608
changrui0608 / message_to_map.cc
Last active April 24, 2022 02:43
pb to map (c++)
// not tested yet
//
std::multimap<std::string, std::string> MessageToMap(
const google::protobuf::Message& message) {
std::multimap<std::string, std::string> params;
auto* descriptor = message.GetDescriptor();
auto* reflection = message.GetReflection();
int field_count = descriptor->field_count();
@changrui0608
changrui0608 / .clang-format
Last active February 6, 2022 16:22
A clang-format configuration for c++ with rust style (as possible).
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak # XXX: prefer `BlockIndent` but not supported on clang-format 13.0.
# AlignArrayOfStructures: None # clang-format 13
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: Right # XXX
AlignOperands: AlignAfterOperator
AlignTrailingComments: true