Skip to content

Commit 0bcd459

Browse files
committed
clang-format
1 parent 436b327 commit 0bcd459

13 files changed

+1837
-1818
lines changed

.clang-format

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
BasedOnStyle: Google
3+
AccessModifierOffset: '-2'
4+
AlignAfterOpenBracket: Align
5+
AlignEscapedNewlinesLeft: 'true'
6+
AlignOperands: 'true'
7+
AlignTrailingComments: 'true'
8+
AllowAllParametersOfDeclarationOnNextLine: 'false'
9+
AllowShortBlocksOnASingleLine: 'false'
10+
AllowShortCaseLabelsOnASingleLine: 'true'
11+
AllowShortFunctionsOnASingleLine: Inline
12+
AllowShortIfStatementsOnASingleLine: 'false'
13+
AllowShortLoopsOnASingleLine: 'false'
14+
AlwaysBreakAfterReturnType: None
15+
BreakBeforeBraces: Custom
16+
BraceWrapping:
17+
AfterCaseLabel: true
18+
AfterClass: true
19+
AfterControlStatement: true
20+
AfterEnum: true
21+
AfterFunction: true
22+
AfterNamespace: true
23+
AfterStruct: true
24+
AfterUnion: true
25+
BeforeCatch: true
26+
BeforeElse: true
27+
SplitEmptyFunction: true
28+
BreakConstructorInitializersBeforeComma: 'true'
29+
ColumnLimit: '200'
30+
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
31+
ConstructorInitializerIndentWidth: '2'
32+
SortIncludes: 'false'
33+
34+
...

OSCRouter/EosPlatform.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,32 @@
2121
#include "EosPlatform.h"
2222

2323
#ifndef WIN32
24-
#include "EosPlatform_Mac.h"
24+
#include "EosPlatform_Mac.h"
2525
#endif
2626

2727
////////////////////////////////////////////////////////////////////////////////
2828

2929
bool EosPlatform::Initialize(std::string& /*error*/)
3030
{
31-
return true;
31+
return true;
3232
}
3333

3434
////////////////////////////////////////////////////////////////////////////////
3535

36-
bool EosPlatform::SetSystemIdleAllowed(bool /*b*/, const std::string& /*reason*/, std::string &error)
36+
bool EosPlatform::SetSystemIdleAllowed(bool /*b*/, const std::string& /*reason*/, std::string& error)
3737
{
38-
error = "not required for this platform";
39-
return false;
38+
error = "not required for this platform";
39+
return false;
4040
}
4141

4242
////////////////////////////////////////////////////////////////////////////////
4343

4444
EosPlatform* EosPlatform::Create()
4545
{
4646
#ifdef WIN32
47-
return (new EosPlatform());
47+
return (new EosPlatform());
4848
#else
49-
return (new EosPlatform_Mac());
49+
return (new EosPlatform_Mac());
5050
#endif
5151
}
5252

OSCRouter/EosPlatform.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
class EosPlatform
3030
{
3131
public:
32-
EosPlatform() {}
33-
virtual ~EosPlatform() {}
34-
virtual bool Initialize(std::string &error);
35-
virtual void Shutdown() {}
36-
virtual bool SetSystemIdleAllowed(bool b, const std::string &reason, std::string &error);
37-
38-
static EosPlatform* Create();
32+
EosPlatform() {}
33+
virtual ~EosPlatform() {}
34+
virtual bool Initialize(std::string &error);
35+
virtual void Shutdown() {}
36+
virtual bool SetSystemIdleAllowed(bool b, const std::string &reason, std::string &error);
37+
38+
static EosPlatform *Create();
3939
};
4040

4141
////////////////////////////////////////////////////////////////////////////////

OSCRouter/ItemState.cpp

+54-56
Original file line numberDiff line numberDiff line change
@@ -32,127 +32,125 @@ const ItemStateTable::ID ItemStateTable::sm_Invalid_Id = static_cast<ItemStateTa
3232

3333
bool ItemState::operator==(const ItemState &other) const
3434
{
35-
return (state==other.state && activity==other.activity);
35+
return (state == other.state && activity == other.activity);
3636
}
3737

3838
////////////////////////////////////////////////////////////////////////////////
3939

4040
bool ItemState::operator!=(const ItemState &other) const
4141
{
42-
return (state!=other.state || activity!=other.activity);
42+
return (state != other.state || activity != other.activity);
4343
}
4444

4545
////////////////////////////////////////////////////////////////////////////////
4646

4747
void ItemState::GetStateName(EnumState state, QString &name)
4848
{
49-
switch( state )
50-
{
51-
case STATE_UNINITIALIZED: name=qApp->tr("..."); return;
52-
case STATE_CONNECTING: name=qApp->tr("Connecting..."); return;
53-
case STATE_CONNECTED: name=qApp->tr("Running"); return;
54-
case STATE_NOT_CONNECTED: name=qApp->tr("Not Running"); return;
55-
}
56-
57-
name = QString();
49+
switch (state)
50+
{
51+
case STATE_UNINITIALIZED: name = qApp->tr("..."); return;
52+
case STATE_CONNECTING: name = qApp->tr("Connecting..."); return;
53+
case STATE_CONNECTED: name = qApp->tr("Running"); return;
54+
case STATE_NOT_CONNECTED: name = qApp->tr("Not Running"); return;
55+
}
56+
57+
name = QString();
5858
}
5959

6060
////////////////////////////////////////////////////////////////////////////////
6161

6262
void ItemState::GetStateColor(EnumState state, QColor &color)
6363
{
64-
switch( state )
65-
{
66-
case STATE_CONNECTING: color=WARNING_COLOR; return;
67-
case STATE_CONNECTED: color=SUCCESS_COLOR; return;
68-
case STATE_NOT_CONNECTED: color=ERROR_COLOR; return;
69-
}
70-
71-
color = MUTED_COLOR;
64+
switch (state)
65+
{
66+
case STATE_CONNECTING: color = WARNING_COLOR; return;
67+
case STATE_CONNECTED: color = SUCCESS_COLOR; return;
68+
case STATE_NOT_CONNECTED: color = ERROR_COLOR; return;
69+
}
70+
71+
color = MUTED_COLOR;
7272
}
7373

7474
////////////////////////////////////////////////////////////////////////////////
7575

7676
ItemStateTable::ItemStateTable()
77-
: m_Dirty(false)
77+
: m_Dirty(false)
7878
{
7979
}
8080

8181
////////////////////////////////////////////////////////////////////////////////
8282

8383
void ItemStateTable::Clear()
8484
{
85-
m_List.clear();
86-
m_Dirty = false;
85+
m_List.clear();
86+
m_Dirty = false;
8787
}
8888

8989
////////////////////////////////////////////////////////////////////////////////
9090

9191
void ItemStateTable::Reset()
9292
{
93-
for(LIST::iterator i=m_List.begin(); i!=m_List.end(); i++)
94-
i->activity = i->dirty = false;
95-
m_Dirty = false;
93+
for (LIST::iterator i = m_List.begin(); i != m_List.end(); i++)
94+
i->activity = i->dirty = false;
95+
m_Dirty = false;
9696
}
9797

9898
////////////////////////////////////////////////////////////////////////////////
9999

100100
void ItemStateTable::Deactivate()
101101
{
102-
ItemState deactivated;
103-
for(ID i=0; i<m_List.size(); i++)
104-
Update(i, deactivated);
102+
ItemState deactivated;
103+
for (ID i = 0; i < m_List.size(); i++)
104+
Update(i, deactivated);
105105
}
106106

107107
////////////////////////////////////////////////////////////////////////////////
108108

109109
void ItemStateTable::Flush(ItemStateTable &other)
110110
{
111-
if( other.m_Dirty )
112-
{
113-
for(ID i=0; i<other.m_List.size(); i++)
114-
{
115-
ItemState &otherItemState = other.m_List[i];
116-
Update(i, otherItemState);
117-
otherItemState.dirty = false;
118-
otherItemState.activity = false;
119-
}
120-
121-
other.m_Dirty = false;
122-
}
111+
if (other.m_Dirty)
112+
{
113+
for (ID i = 0; i < other.m_List.size(); i++)
114+
{
115+
ItemState &otherItemState = other.m_List[i];
116+
Update(i, otherItemState);
117+
otherItemState.dirty = false;
118+
otherItemState.activity = false;
119+
}
120+
121+
other.m_Dirty = false;
122+
}
123123
}
124124

125125
////////////////////////////////////////////////////////////////////////////////
126126

127127
ItemStateTable::ID ItemStateTable::Register()
128128
{
129-
m_List.push_back( ItemState() );
130-
return (m_List.size() - 1);
129+
m_List.push_back(ItemState());
130+
return (m_List.size() - 1);
131131
}
132132

133133
////////////////////////////////////////////////////////////////////////////////
134134

135135
void ItemStateTable::Update(ID id, const ItemState &state)
136136
{
137-
if(id < m_List.size())
138-
{
139-
ItemState &itemState = m_List[id];
140-
if(itemState != state)
141-
{
142-
itemState = state;
143-
itemState.dirty = true;
144-
m_Dirty = true;
145-
}
146-
}
137+
if (id < m_List.size())
138+
{
139+
ItemState &itemState = m_List[id];
140+
if (itemState != state)
141+
{
142+
itemState = state;
143+
itemState.dirty = true;
144+
m_Dirty = true;
145+
}
146+
}
147147
}
148148

149149
////////////////////////////////////////////////////////////////////////////////
150150

151-
const ItemState* ItemStateTable::GetItemState(ID id) const
151+
const ItemState *ItemStateTable::GetItemState(ID id) const
152152
{
153-
return ((id<m_List.size())
154-
? (&(m_List[id]))
155-
: 0);
153+
return ((id < m_List.size()) ? (&(m_List[id])) : 0);
156154
}
157155

158156
////////////////////////////////////////////////////////////////////////////////

OSCRouter/ItemState.h

+41-40
Original file line numberDiff line numberDiff line change
@@ -32,58 +32,59 @@ class QString;
3232
class ItemState
3333
{
3434
public:
35-
enum EnumState
36-
{
37-
STATE_UNINITIALIZED = 0,
38-
STATE_CONNECTING,
39-
STATE_CONNECTED,
40-
STATE_NOT_CONNECTED,
41-
42-
STATE_COUNT
43-
};
44-
45-
ItemState()
46-
: state(STATE_UNINITIALIZED)
47-
, activity(false)
48-
, dirty(false)
49-
{}
50-
51-
bool operator==(const ItemState &other) const;
52-
bool operator!=(const ItemState &other) const;
53-
54-
EnumState state;
55-
bool activity;
56-
bool dirty;
57-
58-
static void GetStateName(EnumState state, QString &name);
59-
static void GetStateColor(EnumState state, QColor &color);
35+
enum EnumState
36+
{
37+
STATE_UNINITIALIZED = 0,
38+
STATE_CONNECTING,
39+
STATE_CONNECTED,
40+
STATE_NOT_CONNECTED,
41+
42+
STATE_COUNT
43+
};
44+
45+
ItemState()
46+
: state(STATE_UNINITIALIZED)
47+
, activity(false)
48+
, dirty(false)
49+
{
50+
}
51+
52+
bool operator==(const ItemState &other) const;
53+
bool operator!=(const ItemState &other) const;
54+
55+
EnumState state;
56+
bool activity;
57+
bool dirty;
58+
59+
static void GetStateName(EnumState state, QString &name);
60+
static void GetStateColor(EnumState state, QColor &color);
6061
};
6162

6263
////////////////////////////////////////////////////////////////////////////////
6364

6465
class ItemStateTable
6566
{
6667
public:
67-
typedef size_t ID;
68-
typedef std::vector<ItemState> LIST;
68+
typedef size_t ID;
69+
typedef std::vector<ItemState> LIST;
6970

70-
ItemStateTable();
71+
ItemStateTable();
7172

72-
virtual void Clear();
73-
virtual void Reset();
74-
virtual void Deactivate();
75-
virtual void Flush(ItemStateTable &other);
76-
virtual bool GetDirty() const {return m_Dirty;}
77-
virtual ID Register();
78-
virtual void Update(ID id, const ItemState &state);
79-
virtual const ItemState* GetItemState(ID id) const;
80-
virtual const LIST& GetList() const {return m_List;}
73+
virtual void Clear();
74+
virtual void Reset();
75+
virtual void Deactivate();
76+
virtual void Flush(ItemStateTable &other);
77+
virtual bool GetDirty() const { return m_Dirty; }
78+
virtual ID Register();
79+
virtual void Update(ID id, const ItemState &state);
80+
virtual const ItemState *GetItemState(ID id) const;
81+
virtual const LIST &GetList() const { return m_List; }
8182

82-
static const ID sm_Invalid_Id;
83+
static const ID sm_Invalid_Id;
8384

8485
private:
85-
bool m_Dirty;
86-
LIST m_List;
86+
bool m_Dirty;
87+
LIST m_List;
8788
};
8889

8990
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)