THRIFT-2729: C++ - .clang-format created and applied
Client: C++
Patch: Konrad Grochowski
make style command added
diff --git a/compiler/cpp/src/parse/t_field.h b/compiler/cpp/src/parse/t_field.h
index c05fdf3..c4e30e3 100644
--- a/compiler/cpp/src/parse/t_field.h
+++ b/compiler/cpp/src/parse/t_field.h
@@ -34,96 +34,65 @@
*
*/
class t_field : public t_doc {
- public:
- t_field(t_type* type, std::string name) :
- type_(type),
- name_(name),
- key_(0),
- value_(NULL),
- xsd_optional_(false),
- xsd_nillable_(false),
- xsd_attrs_(NULL),
- reference_(false) {}
+public:
+ t_field(t_type* type, std::string name)
+ : type_(type),
+ name_(name),
+ key_(0),
+ value_(NULL),
+ xsd_optional_(false),
+ xsd_nillable_(false),
+ xsd_attrs_(NULL),
+ reference_(false) {}
- t_field(t_type* type, std::string name, int32_t key) :
- type_(type),
- name_(name),
- key_(key),
- req_(T_OPT_IN_REQ_OUT),
- value_(NULL),
- xsd_optional_(false),
- xsd_nillable_(false),
- xsd_attrs_(NULL),
- reference_(false) {}
+ t_field(t_type* type, std::string name, int32_t key)
+ : type_(type),
+ name_(name),
+ key_(key),
+ req_(T_OPT_IN_REQ_OUT),
+ value_(NULL),
+ xsd_optional_(false),
+ xsd_nillable_(false),
+ xsd_attrs_(NULL),
+ reference_(false) {}
~t_field() {}
- t_type* get_type() const {
- return type_;
- }
+ t_type* get_type() const { return type_; }
- const std::string& get_name() const {
- return name_;
- }
+ const std::string& get_name() const { return name_; }
- int32_t get_key() const {
- return key_;
- }
+ int32_t get_key() const { return key_; }
- enum e_req {
- T_REQUIRED,
- T_OPTIONAL,
- T_OPT_IN_REQ_OUT
- };
+ enum e_req { T_REQUIRED, T_OPTIONAL, T_OPT_IN_REQ_OUT };
- void set_req(e_req req) {
- req_ = req;
- }
+ void set_req(e_req req) { req_ = req; }
- e_req get_req() const {
- return req_;
- }
+ e_req get_req() const { return req_; }
- void set_value(t_const_value* value) {
- value_ = value;
- }
+ void set_value(t_const_value* value) { value_ = value; }
- t_const_value* get_value() {
- return value_;
- }
+ t_const_value* get_value() { return value_; }
- void set_xsd_optional(bool xsd_optional) {
- xsd_optional_ = xsd_optional;
- }
+ void set_xsd_optional(bool xsd_optional) { xsd_optional_ = xsd_optional; }
- bool get_xsd_optional() const {
- return xsd_optional_;
- }
+ bool get_xsd_optional() const { return xsd_optional_; }
- void set_xsd_nillable(bool xsd_nillable) {
- xsd_nillable_ = xsd_nillable;
- }
+ void set_xsd_nillable(bool xsd_nillable) { xsd_nillable_ = xsd_nillable; }
- bool get_xsd_nillable() const {
- return xsd_nillable_;
- }
+ bool get_xsd_nillable() const { return xsd_nillable_; }
- void set_xsd_attrs(t_struct* xsd_attrs) {
- xsd_attrs_ = xsd_attrs;
- }
+ void set_xsd_attrs(t_struct* xsd_attrs) { xsd_attrs_ = xsd_attrs; }
- t_struct* get_xsd_attrs() {
- return xsd_attrs_;
- }
+ t_struct* get_xsd_attrs() { return xsd_attrs_; }
// This is not the same function as t_type::get_fingerprint_material,
// but it does the same thing.
std::string get_fingerprint_material() const {
std::ostringstream keystm;
keystm << key_;
- return keystm.str() + ":" +
- ((req_ == T_OPTIONAL) ? "opt-" : "") +
- type_->get_fingerprint_material();
+ return keystm.str() + ":" + ((req_ == T_OPTIONAL) ? "opt-" : "")
+ + type_->get_fingerprint_material();
}
/**
@@ -132,22 +101,18 @@
* The arguments are (const) references to const pointers to const t_fields.
*/
struct key_compare {
- bool operator()(t_field const * const & a, t_field const * const & b) {
+ bool operator()(t_field const* const& a, t_field const* const& b) {
return a->get_key() < b->get_key();
}
};
std::map<std::string, std::string> annotations_;
- bool get_reference() {
- return reference_;
- }
+ bool get_reference() { return reference_; }
- void set_reference(bool reference) {
- reference_ = reference;
- }
+ void set_reference(bool reference) { reference_ = reference; }
- private:
+private:
t_type* type_;
std::string name_;
int32_t key_;