comparison libgui/graphics/Logger.cc @ 19967:3cc0734283dc

style fixes in Qt graphics code * Backend.cc, BaseControl.cc, ButtonControl.cc, Canvas.cc, CheckBoxControl.cc, Container.cc, ContextMenu.cc, EditControl.cc, Figure.cc, FigureWindow.cc, GLCanvas.cc, KeyMap.cc, ListBoxControl.cc, Logger.cc, Menu.cc, MouseModeActionGroup.cc, Object.cc, ObjectFactory.cc, ObjectProxy.cc, Panel.cc, PopupMenuControl.cc, PushButtonControl.cc, PushTool.cc, QtHandlesUtils.cc, RadioButtonControl.cc, SliderControl.cc, TextControl.cc, TextEdit.cc, ToggleButtonControl.cc, ToggleTool.cc, ToolBar.cc, ToolBarButton.cc, __init_qt__.cc: Follow a few more Octave coding conventions.
author John W. Eaton <jwe@octave.org>
date Thu, 19 Mar 2015 12:27:54 -0400
parents 523878f76518
children f0e61a67ad9f
comparison
equal deleted inserted replaced
19966:40b2c4323c16 19967:3cc0734283dc
37 37
38 Logger* Logger::s_instance = 0; 38 Logger* Logger::s_instance = 0;
39 QMutex* Logger::s_mutex = 0; 39 QMutex* Logger::s_mutex = 0;
40 40
41 Logger::Logger (void) 41 Logger::Logger (void)
42 : m_debugEnabled (false) 42 : m_debugEnabled (false)
43 { 43 {
44 QProcessEnvironment pe (QProcessEnvironment::systemEnvironment ()); 44 QProcessEnvironment pe (QProcessEnvironment::systemEnvironment ());
45 45
46 if (pe.value ("QTHANDLES_DEBUG", "0") != "0") 46 if (pe.value ("QTHANDLES_DEBUG", "0") != "0")
47 m_debugEnabled = true; 47 m_debugEnabled = true;
49 49
50 Logger::~Logger (void) 50 Logger::~Logger (void)
51 { 51 {
52 } 52 }
53 53
54 Logger* Logger::instance (void) 54 Logger*
55 Logger::instance (void)
55 { 56 {
56 if (! s_instance) 57 if (! s_instance)
57 { 58 {
58 s_instance = new Logger (); 59 s_instance = new Logger ();
59 s_mutex = new QMutex (); 60 s_mutex = new QMutex ();
61 62
62 return s_instance; 63 return s_instance;
63 } 64 }
64 65
65 #define STATIC_LOGGER(fun) \ 66 #define STATIC_LOGGER(fun) \
66 void Logger::fun (const char* fmt, ...) \ 67 void Logger::fun (const char* fmt, ...) \
67 { \ 68 { \
68 QMutexLocker lock (s_mutex); \ 69 QMutexLocker lock (s_mutex); \
69 va_list vl; \ 70 va_list vl; \
70 va_start (vl, fmt); \ 71 va_start (vl, fmt); \
71 instance ()->fun ## V (fmt, vl); \ 72 instance ()->fun ## V (fmt, vl); \
72 va_end (vl); \ 73 va_end (vl); \
73 } 74 }
74 75
75 STATIC_LOGGER (debug) 76 STATIC_LOGGER (debug)
76 77
77 void Logger::debugV (const char* fmt, va_list arg) 78 void
79 Logger::debugV (const char* fmt, va_list arg)
78 { 80 {
79 if (m_debugEnabled) 81 if (m_debugEnabled)
80 { 82 {
81 vfprintf (stderr, fmt, arg); 83 vfprintf (stderr, fmt, arg);
82 fprintf (stderr, "\n"); 84 fprintf (stderr, "\n");