BigBahss / vscode-cmantic

C/C++ code generation for VS Code: Generate Definitions, Getters, Setters, and much more.
https://bigbahss.github.io/vscode-cmantic/
MIT License
84 stars 9 forks source link

Getter/setter customization #59

Open zhyh2010 opened 1 year ago

zhyh2010 commented 1 year ago

I found https://github.com/BigBahss/vscode-cmantic/issues/11, but it does not work for me. my code is like this: class WatchData { public: std::string GetSubscribeName() const { return SubscribeName; } void SetSubscribeName(const std::string &subscribeName) { mSubscribeName = subscribeName; }

private: std::string mSubscribeName; };

however, when use the plugin, i cannot generate code above. Is there any way to generate code for customization

zhyh2010 commented 1 year ago

also, sometimes , i want to generate code like this, add inline const before Get Method class WatchData { public: inline const std::string &GetSubscribeName() const { return SubscribeName; } inline void SetSubscribeName(const std::string &subscribeName) { mSubscribeName = subscribeName; }

inline const std::string &GetWatchJobName() const { return WatchJobName; } inline void SetWatchJobName(const std::string &watchJobName) { mWatchJobName = watchJobName; }

inline const std::vector &GetWatchValueList() const { return WatchValueList; } inline void SetWatchValueList(const std::vector &watchValueList) { mWatchValueList = watchValueList; }

inline const std::vector &GetAttributeNames() const { return AttributeNames; } inline void SetAttributeNames(const std::vector &attributeNames) { mAttributeNames = attributeNames; }

private: std::string mSubscribeName; std::string mWatchJobName; std::vector mWatchValueList; std::vector mAttributeNames; };