Use clang-format to define single-line functions

I know that you can align variable definitions and affectations with clang-format using AlignConsecutiveAssignments and AlignConsecutiveDeclarations to get something like

 int a_value; unsigned int another_value; float a_last_value; a_value = 2; another_value = 3; a_last_value = 42.0f; // Or both at the same time int a_value = 2; unsigned int another_value = 3; float a_last_value = 42.0f; 

Now, is there a way to make similar stuff with single-line functions / methods (single-line using AllowShortFunctionsOnASingleLine for example)? I want to get something like

 void SetPositions(const vec3_array& p) { m_Data.Positions = p; } void SetUVs(const vec2_array& u) { m_Data.UVs = u; } void SetNormals(const vec3_array& n) { m_Data.Normals = n; } void SetIndices(const UIntArray& i) { m_Data.Indices = i; } 

or maybe even

 void SetPositions(const vec3_array& p) { m_Data.Positions = p; } void SetUVs (const vec2_array& u) { m_Data.UVs = u; } void SetNormals (const vec3_array& n) { m_Data.Normals = n; } void SetIndices (const UIntArray& i) { m_Data.Indices = i; } 

instead

 void SetPositions (const vec3_array& p) { m_Data.Positions = p; } void SetUVs(const vec2_array& u) { m_Data.UVs = u; } void SetNormals(const vec3_array& n) { m_Data.Normals = n; } void SetIndices(const UIntArray& i) { m_Data.Indices = i; } 
+5
source share

Source: https://habr.com/ru/post/1258207/


All Articles