Automatic style cleanup with the astyle program.
This commit is contained in:
parent
082f2ad34e
commit
a651de0f53
|
@ -39,8 +39,7 @@ Emoconfig::Emoconfig(const char* xmlfile):BMessage()
|
|||
BFile* settings = new BFile(xmlfile, B_READ_ONLY);
|
||||
off_t size;
|
||||
settings->GetSize(&size);
|
||||
if(size)
|
||||
{
|
||||
if (size) {
|
||||
void* buffer = malloc(size);
|
||||
size = settings->Read(buffer, size);
|
||||
XML_Parse(fParser, (const char*)buffer, size, true);
|
||||
|
@ -65,28 +64,17 @@ Emoconfig::StartElement(void * /*pUserData*/, const char * pName, const char **
|
|||
{
|
||||
//printf("StartElement %s\n",pName);
|
||||
BString name(pName);
|
||||
if(name.ICompare("emoticon")==0)
|
||||
{
|
||||
if (name.ICompare("emoticon") == 0) {
|
||||
faces = new BMessage();
|
||||
svg = false;
|
||||
}
|
||||
else
|
||||
if(name.ICompare("text")==0 && faces)
|
||||
{
|
||||
} else if (name.ICompare("text") == 0 && faces) {
|
||||
valid = true;
|
||||
}
|
||||
else
|
||||
if(name.ICompare("file")==0 && faces)
|
||||
{
|
||||
} else if (name.ICompare("file") == 0 && faces) {
|
||||
fname = true;
|
||||
} else
|
||||
if(name.ICompare("svg")==0 && faces)
|
||||
{
|
||||
} else if (name.ICompare("svg") == 0 && faces) {
|
||||
// printf("File is SVG\n");
|
||||
svg = true;
|
||||
} else
|
||||
if(name.ICompare("size")==0)
|
||||
{
|
||||
} else if (name.ICompare("size") == 0) {
|
||||
size = true;
|
||||
gCharacters = "";
|
||||
}
|
||||
|
@ -98,25 +86,18 @@ Emoconfig::EndElement(void * pUserData, const char * pName)
|
|||
//printf("EndElement %s\n",pName);
|
||||
BString name(pName);
|
||||
|
||||
if(name.ICompare("emoticon")==0 && faces)
|
||||
{
|
||||
if (name.ICompare("emoticon") == 0 && faces) {
|
||||
//faces->PrintToStream(); //debug
|
||||
delete faces;
|
||||
faces = NULL;
|
||||
|
||||
}
|
||||
else
|
||||
if(name.ICompare("text")==0 && faces)
|
||||
{
|
||||
} else if (name.ICompare("text") == 0 && faces) {
|
||||
valid = false;
|
||||
faces->AddString("face", face);
|
||||
//printf("to ]%s[\n",face.String());
|
||||
face.SetTo("");
|
||||
|
||||
}
|
||||
else
|
||||
if(name.ICompare("file")==0 && faces)
|
||||
{
|
||||
} else if (name.ICompare("file") == 0 && faces) {
|
||||
//load file
|
||||
|
||||
//compose the filename
|
||||
|
@ -124,8 +105,8 @@ Emoconfig::EndElement(void * pUserData, const char * pName)
|
|||
p.Append(filename.String());
|
||||
BBitmap* icons = NULL;
|
||||
|
||||
if ( !svg )
|
||||
{ //
|
||||
if ( !svg ) {
|
||||
//
|
||||
icons = BTranslationUtils::GetBitmap(p.Path());
|
||||
}
|
||||
|
||||
|
@ -137,11 +118,9 @@ Emoconfig::EndElement(void * pUserData, const char * pName)
|
|||
|
||||
int i = 0;
|
||||
BString s;
|
||||
while(faces->FindString("face",i,&s)==B_OK)
|
||||
{
|
||||
while (faces->FindString("face", i, &s) == B_OK) {
|
||||
|
||||
if(i==0)
|
||||
{
|
||||
if (i == 0) {
|
||||
((Emoconfig*)pUserData)->menu.AddPointer(s.String(), (const void*)icons);
|
||||
((Emoconfig*)pUserData)->menu.AddString("face", s.String());
|
||||
}
|
||||
|
@ -153,11 +132,8 @@ Emoconfig::EndElement(void * pUserData, const char * pName)
|
|||
}
|
||||
|
||||
|
||||
} else
|
||||
if(name.ICompare("size")==0)
|
||||
{
|
||||
if ( size )
|
||||
{
|
||||
} else if (name.ICompare("size") == 0) {
|
||||
if ( size ) {
|
||||
((Emoconfig*)pUserData)->fEmoticonSize = atoi(gCharacters.String());
|
||||
}
|
||||
|
||||
|
@ -171,22 +147,16 @@ Emoconfig::Characters(void * /*pUserData*/, const char * pString, int pLen)
|
|||
{
|
||||
BString f(pString, pLen);
|
||||
//printf("Characters %s\n",f.String());
|
||||
if(faces && valid)
|
||||
{
|
||||
if (faces && valid) {
|
||||
f.RemoveAll(" ");
|
||||
f.RemoveAll("\"");
|
||||
if (f.Length() > 0)
|
||||
face.Append(f);
|
||||
}
|
||||
else
|
||||
if(fname)
|
||||
{
|
||||
} else if (fname) {
|
||||
f.RemoveAll(" ");
|
||||
filename = f;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
gCharacters.Append(f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,9 @@ class Emoconfig : public BMessage
|
|||
int numfaces;
|
||||
BMessage menu;
|
||||
|
||||
float GetEmoticonSize() { return fEmoticonSize; }
|
||||
float GetEmoticonSize() {
|
||||
return fEmoticonSize;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -52,8 +52,7 @@ Emoticor::_findTokens(RunView *fTextView,BString text,int tokenstart, int16 cols
|
|||
BString cur;
|
||||
int i = tokenstart;
|
||||
|
||||
if (fConfig != NULL)
|
||||
{
|
||||
if (fConfig != NULL) {
|
||||
while (fConfig->FindString("face", i, &cur) == B_OK)
|
||||
//for(int i=tokenstart;i<config->numfaces;i++)
|
||||
{
|
||||
|
@ -62,19 +61,16 @@ Emoticor::_findTokens(RunView *fTextView,BString text,int tokenstart, int16 cols
|
|||
|
||||
newindex = 0;
|
||||
|
||||
while(true)
|
||||
{
|
||||
while (true) {
|
||||
newindex = text.IFindFirst(cur.String(), 0);
|
||||
//printf("Try %d %s -- match %d\n",i,cur->original.String(),newindex);
|
||||
|
||||
if(newindex!=B_ERROR)
|
||||
{
|
||||
if (newindex != B_ERROR) {
|
||||
//take a walk on the left side ;)
|
||||
|
||||
//printf("Found at %ld \n",newindex);
|
||||
|
||||
if(newindex-1>=0)
|
||||
{
|
||||
if (newindex - 1 >= 0) {
|
||||
BString left;
|
||||
text.CopyInto(left, 0, newindex);
|
||||
//printf("ready to recourse! [%s]\n",left.String());
|
||||
|
@ -89,8 +85,7 @@ Emoticor::_findTokens(RunView *fTextView,BString text,int tokenstart, int16 cols
|
|||
fTextView->Append(cur.String(), cols2, cols2, font2);
|
||||
|
||||
if (text.Length() == 0) return; //useless stack
|
||||
}
|
||||
else
|
||||
} else
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -25,14 +25,17 @@ class NormalTextRender : public TextRender
|
|||
};
|
||||
|
||||
|
||||
virtual float Size(){ return font.Size();}
|
||||
virtual float Size() {
|
||||
return font.Size();
|
||||
}
|
||||
|
||||
virtual void GetHeight(font_height *height){ font.GetHeight(height); };
|
||||
virtual void GetHeight(font_height* height) {
|
||||
font.GetHeight(height);
|
||||
};
|
||||
|
||||
|
||||
virtual void
|
||||
GetEscapements(const char charArray[], int32 numChars,float escapementArray[])
|
||||
{
|
||||
GetEscapements(const char charArray[], int32 numChars, float escapementArray[]) {
|
||||
font.GetEscapements(charArray, numChars, escapementArray);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,9 @@ struct UnaryPredicate {
|
|||
virtual int operator()(const T*) const
|
||||
// virtual could be avoided here if FindBinaryInsertionIndex,
|
||||
// etc. were member template functions
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
static int _unary_predicate_glue(const void* item, void* context);
|
||||
|
@ -92,7 +94,8 @@ UnaryPredicate<T>::_unary_predicate_glue(const void *item, void *context)
|
|||
}
|
||||
|
||||
|
||||
class _PointerList_ : public BList {
|
||||
class _PointerList_ : public BList
|
||||
{
|
||||
public:
|
||||
_PointerList_(const _PointerList_ &list);
|
||||
_PointerList_(int32 itemsPerBlock = 20, bool owning = false);
|
||||
|
@ -126,7 +129,8 @@ protected:
|
|||
};
|
||||
|
||||
template<class T>
|
||||
class BObjectList : private _PointerList_ {
|
||||
class BObjectList : private _PointerList_
|
||||
{
|
||||
public:
|
||||
|
||||
// iteration and sorting
|
||||
|
@ -238,10 +242,12 @@ public:
|
|||
// or index of an existing item that matches the predicate
|
||||
|
||||
// deprecated API, will go away
|
||||
BList *AsBList()
|
||||
{ return this; }
|
||||
const BList *AsBList() const
|
||||
{ return this; }
|
||||
BList* AsBList() {
|
||||
return this;
|
||||
}
|
||||
const BList* AsBList() const {
|
||||
return this;
|
||||
}
|
||||
private:
|
||||
void SetItem(int32, T*);
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -70,21 +70,18 @@ class SelectPos
|
|||
~SelectPos (void)
|
||||
{ }
|
||||
|
||||
SelectPos &operator = (const SelectPos &pos)
|
||||
{
|
||||
SelectPos& operator = (const SelectPos& pos) {
|
||||
fLine = pos.fLine;
|
||||
fOffset = pos.fOffset;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline int operator == (const SelectPos &rhs) const
|
||||
{
|
||||
inline int operator == (const SelectPos& rhs) const {
|
||||
return ((fLine == rhs.fLine) && (fOffset == rhs.fOffset));
|
||||
}
|
||||
|
||||
inline int operator != (const SelectPos &rhs) const
|
||||
{
|
||||
inline int operator != (const SelectPos& rhs) const {
|
||||
return (!(*this == rhs));
|
||||
}
|
||||
|
||||
|
@ -149,8 +146,10 @@ class RunView : public BView
|
|||
virtual void MessageReceived (BMessage*);
|
||||
|
||||
virtual void SetViewColor (rgb_color);
|
||||
void SetViewColor (uchar red, uchar green, uchar blue, uchar alpha = 255)
|
||||
{ rgb_color color = {red, green, blue, alpha}; SetViewColor (color); }
|
||||
void SetViewColor (uchar red, uchar green, uchar blue, uchar alpha = 255) {
|
||||
rgb_color color = {red, green, blue, alpha};
|
||||
SetViewColor (color);
|
||||
}
|
||||
|
||||
|
||||
virtual void MouseDown (BPoint);
|
||||
|
|
|
@ -25,8 +25,7 @@ class SmileTextRender : public TextRender
|
|||
BBitmap* pointer = NULL;
|
||||
BString f(txt, num);
|
||||
|
||||
if(Emoticor::Get()->Config()->FindPointer(f.String(),(void**)&pointer)==B_OK)
|
||||
{
|
||||
if (Emoticor::Get()->Config()->FindPointer(f.String(), (void**)&pointer) == B_OK) {
|
||||
target->SetDrawingMode( B_OP_ALPHA );
|
||||
target->DrawBitmapAsync( pointer, BPoint(pos.x, pos.y - (Emoticor::Get()->Config()->GetEmoticonSize() / 2)) );
|
||||
target->SetDrawingMode( B_OP_OVER );
|
||||
|
@ -34,17 +33,17 @@ class SmileTextRender : public TextRender
|
|||
};
|
||||
|
||||
|
||||
virtual float Size(){ return Emoticor::Get()->Config()->GetEmoticonSize();}
|
||||
virtual float Size() {
|
||||
return Emoticor::Get()->Config()->GetEmoticonSize();
|
||||
}
|
||||
|
||||
virtual void GetHeight(font_height *h)
|
||||
{
|
||||
virtual void GetHeight(font_height* h) {
|
||||
h->descent = h->ascent = Emoticor::Get()->Config()->GetEmoticonSize() / 2;
|
||||
h->leading = 0;
|
||||
};
|
||||
|
||||
virtual void
|
||||
GetEscapements(const char * /*charArray*/, int32 numChars,float escapementArray[])
|
||||
{
|
||||
GetEscapements(const char * /*charArray*/, int32 numChars, float escapementArray[]) {
|
||||
//font.GetEscapements(charArray,numChars,escapementArray);
|
||||
escapementArray[0] = 1;
|
||||
for (int i = 1; i < numChars; i++) escapementArray[i] = 0;
|
||||
|
|
|
@ -73,8 +73,9 @@ class Theme
|
|||
int16);
|
||||
virtual ~Theme (void);
|
||||
|
||||
const char *Name (void) const
|
||||
{ return name; }
|
||||
const char* Name (void) const {
|
||||
return name;
|
||||
}
|
||||
|
||||
void ReadLock (void);
|
||||
void ReadUnlock (void);
|
||||
|
@ -94,11 +95,15 @@ class Theme
|
|||
TextRender* TextRenderAt(int16);
|
||||
|
||||
bool SetForeground (int16, const rgb_color);
|
||||
bool SetForeground (int16 w, uchar r, uchar g, uchar b, uchar a = 255)
|
||||
{ rgb_color color = {r, g, b, a}; return SetForeground (w, color); }
|
||||
bool SetForeground (int16 w, uchar r, uchar g, uchar b, uchar a = 255) {
|
||||
rgb_color color = {r, g, b, a};
|
||||
return SetForeground (w, color);
|
||||
}
|
||||
bool SetBackground (int16, const rgb_color);
|
||||
bool SetBackground (int16 w, uchar r, uchar g, uchar b, uchar a = 255)
|
||||
{ rgb_color color = {r, g, b, a}; return SetBackground (w, color); }
|
||||
bool SetBackground (int16 w, uchar r, uchar g, uchar b, uchar a = 255) {
|
||||
rgb_color color = {r, g, b, a};
|
||||
return SetBackground (w, color);
|
||||
}
|
||||
|
||||
//bool SetFont (int16, const BFont &);
|
||||
bool SetTextRender(int16, TextRender*);
|
||||
|
@ -106,8 +111,12 @@ class Theme
|
|||
void SetSoftLineIndent(float indent);
|
||||
void SetTextMargin(float margin);
|
||||
|
||||
float TextMargin() const { return fTextMargin; }
|
||||
float SoftLineIndent() const { return fSoftLineIndent; }
|
||||
float TextMargin() const {
|
||||
return fTextMargin;
|
||||
}
|
||||
float SoftLineIndent() const {
|
||||
return fSoftLineIndent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ URLCrunch::Crunch (BString *url)
|
|||
return B_ERROR;
|
||||
|
||||
const int32 tagNum = 7;
|
||||
const char *tags[tagNum] =
|
||||
{
|
||||
const char* tags[tagNum] = {
|
||||
"http://",
|
||||
"https://",
|
||||
"www.",
|
||||
|
@ -65,8 +64,7 @@ URLCrunch::Crunch (BString *url)
|
|||
for (i = 0; i < tagNum; ++i)
|
||||
|
||||
if (markers[i] != B_ERROR
|
||||
&& markers[i] < marker)
|
||||
{
|
||||
&& markers[i] < marker) {
|
||||
url_length = markers[i] + strlen(tags[i]);
|
||||
|
||||
url_length += strcspn (buffer.String() + url_length, " \t\n|\\<>\")(][}{;'*^");
|
||||
|
@ -76,18 +74,15 @@ URLCrunch::Crunch (BString *url)
|
|||
|
||||
if (url_length - markers[i] > len
|
||||
&& (isdigit (buffer[markers[i] + len])
|
||||
|| isalpha (buffer[markers[i] + len])))
|
||||
{
|
||||
|| isalpha (buffer[markers[i] + len]))) {
|
||||
marker = markers[i];
|
||||
pos = url_length + 1;
|
||||
url_length -= marker;
|
||||
}
|
||||
else
|
||||
} else
|
||||
pos = markers[i] + 1;
|
||||
}
|
||||
|
||||
if (marker < buffer.Length())
|
||||
{
|
||||
if (marker < buffer.Length()) {
|
||||
*url = "";
|
||||
|
||||
url->Append (buffer.String() + marker, url_length);
|
||||
|
|
|
@ -44,8 +44,7 @@ GetWord (const char *cData, int32 wordNeeded)
|
|||
BString buffer ("-9z99");
|
||||
int32 wordAt (1), place (0);
|
||||
|
||||
while (wordAt != wordNeeded && place != B_ERROR)
|
||||
{
|
||||
while (wordAt != wordNeeded && place != B_ERROR) {
|
||||
if ((place = data.FindFirst ('\x20', place)) != B_ERROR)
|
||||
if (++place < data.Length()
|
||||
&& data[place] != '\x20')
|
||||
|
@ -54,8 +53,7 @@ GetWord (const char *cData, int32 wordNeeded)
|
|||
|
||||
if (wordAt == wordNeeded
|
||||
&& place != B_ERROR
|
||||
&& place < data.Length())
|
||||
{
|
||||
&& place < data.Length()) {
|
||||
int32 end (data.FindFirst ('\x20', place));
|
||||
|
||||
if (end == B_ERROR)
|
||||
|
@ -79,8 +77,7 @@ GetWordColon (const char *cData, int32 wordNeeded)
|
|||
BString buffer ("-9z99");
|
||||
int32 wordAt (1), place (0);
|
||||
|
||||
while (wordAt != wordNeeded && place != B_ERROR)
|
||||
{
|
||||
while (wordAt != wordNeeded && place != B_ERROR) {
|
||||
if ((place = data.FindFirst (':', place)) != B_ERROR)
|
||||
if (++place < data.Length()
|
||||
&& data[place] != ':')
|
||||
|
@ -89,8 +86,7 @@ GetWordColon (const char *cData, int32 wordNeeded)
|
|||
|
||||
if (wordAt == wordNeeded
|
||||
&& place != B_ERROR
|
||||
&& place < data.Length())
|
||||
{
|
||||
&& place < data.Length()) {
|
||||
int32 end (data.FindFirst (':', place));
|
||||
|
||||
if (end == B_ERROR)
|
||||
|
@ -115,8 +111,7 @@ RestOfString (const char *cData, int32 wordStart)
|
|||
int32 wordAt (1), place (0);
|
||||
BString buffer ("-9z99");
|
||||
|
||||
while (wordAt != wordStart && place != B_ERROR)
|
||||
{
|
||||
while (wordAt != wordStart && place != B_ERROR) {
|
||||
if ((place = data.FindFirst ('\x20', place)) != B_ERROR)
|
||||
if (++place < data.Length()
|
||||
&& data[place] != '\x20')
|
||||
|
@ -163,8 +158,7 @@ GetIdent (const char *cData)
|
|||
int32 place[2];
|
||||
|
||||
if ((place[0] = data.FindFirst ('!')) != B_ERROR
|
||||
&& (place[1] = data.FindFirst ('@')) != B_ERROR)
|
||||
{
|
||||
&& (place[1] = data.FindFirst ('@')) != B_ERROR) {
|
||||
++(place[0]);
|
||||
data.CopyInto (theIdent, place[0], place[1] - place[0]);
|
||||
}
|
||||
|
@ -185,8 +179,7 @@ GetAddress (const char *cData)
|
|||
BString address;
|
||||
int32 place;
|
||||
|
||||
if ((place = data.FindFirst ('@')) != B_ERROR)
|
||||
{
|
||||
if ((place = data.FindFirst ('@')) != B_ERROR) {
|
||||
int32 length (data.FindFirst ('\x20', place));
|
||||
|
||||
if (length == B_ERROR)
|
||||
|
@ -232,10 +225,8 @@ ExpandKeyed (
|
|||
{
|
||||
BString buffer;
|
||||
|
||||
while (incoming && *incoming)
|
||||
{
|
||||
if (*incoming == '$')
|
||||
{
|
||||
while (incoming && *incoming) {
|
||||
if (*incoming == '$') {
|
||||
const char* place;
|
||||
|
||||
++incoming;
|
||||
|
@ -244,8 +235,7 @@ ExpandKeyed (
|
|||
buffer += expansions[place - keys];
|
||||
else
|
||||
buffer += *incoming;
|
||||
}
|
||||
else
|
||||
} else
|
||||
buffer += *incoming;
|
||||
|
||||
++incoming;
|
||||
|
@ -344,8 +334,7 @@ Get440Len (const char *cData)
|
|||
|
||||
if (data.Length() < 440)
|
||||
return data.Length();
|
||||
else
|
||||
{
|
||||
else {
|
||||
int32 place (data.FindLast ('\x20', 440));
|
||||
if (place == B_ERROR)
|
||||
return 440;
|
||||
|
|
|
@ -26,20 +26,18 @@
|
|||
|
||||
#include <String.h>
|
||||
|
||||
template<class T> class AutoDestructor {
|
||||
public:
|
||||
AutoDestructor(T *t)
|
||||
template<class T> class AutoDestructor
|
||||
{
|
||||
public:
|
||||
AutoDestructor(T* t) {
|
||||
fObject = t;
|
||||
}
|
||||
|
||||
virtual ~AutoDestructor(void)
|
||||
{
|
||||
virtual ~AutoDestructor(void) {
|
||||
delete fObject;
|
||||
}
|
||||
|
||||
void SetTo(T *t)
|
||||
{
|
||||
void SetTo(T* t) {
|
||||
delete fObject;
|
||||
fObject = t;
|
||||
}
|
||||
|
|
Ŝarĝante…
Reference in New Issue