Changeset 15 in flair-src for trunk/lib/FlairCore/src/Label.cpp


Ignore:
Timestamp:
04/08/16 15:40:57 (8 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/Label.cpp

    r2 r15  
    2222using std::string;
    2323
    24 namespace flair
    25 {
    26 namespace gui
    27 {
     24namespace flair {
     25namespace gui {
    2826
    29 Label::Label(const LayoutPosition* position,string name,size_t buf_size): Widget(position->getLayout(),name,"Label")
    30 {
    31     SetVolatileXmlProp("row",position->Row());
    32     SetVolatileXmlProp("col",position->Col());
     27Label::Label(const LayoutPosition *position, string name, size_t buf_size)
     28    : Widget(position->getLayout(), name, "Label") {
     29  SetVolatileXmlProp("row", position->Row());
     30  SetVolatileXmlProp("col", position->Col());
    3331
    34     SendXml();
     32  SendXml();
    3533
    36     printf_buffer=(char*)malloc(buf_size);
    37     if(printf_buffer==NULL) Err("erreur malloc\n");
     34  printf_buffer = (char *)malloc(buf_size);
     35  if (printf_buffer == NULL)
     36    Err("erreur malloc\n");
    3837
    39     delete position;
     38  delete position;
    4039}
    4140
    42 Label::~Label()
    43 {
    44     if(printf_buffer!=NULL) free(printf_buffer);
    45     printf_buffer=NULL;
     41Label::~Label() {
     42  if (printf_buffer != NULL)
     43    free(printf_buffer);
     44  printf_buffer = NULL;
    4645}
    4746
     47void Label::SetText(const char *format, ...) {
     48  int n;
    4849
    49 void Label::SetText(const char * format, ...)
    50 {
    51     int n;
     50  va_list args;
     51  va_start(args, format);
     52  n = vsprintf(printf_buffer, format, args);
     53  va_end(args);
     54  if (n <= 0)
     55    return;
    5256
    53     va_list args;
    54     va_start (args, format);
    55     n = vsprintf(printf_buffer,format, args);
    56     va_end (args);
    57     if (n<=0) return;
    58 
    59     SetVolatileXmlProp("value",printf_buffer);
    60     SendXml();
    61 
     57  SetVolatileXmlProp("value", printf_buffer);
     58  SendXml();
    6259}
    6360
Note: See TracChangeset for help on using the changeset viewer.