uses enum
[scilab.git] / scilab / modules / output_stream / src / cpp / Diary.cpp
index 06b6da0..efa30ad 100644 (file)
@@ -28,9 +28,9 @@ Diary::Diary(std::wstring _wfilename,int _mode,int ID)
 
        suspendwrite = false;
 
-       Prefixmode = 0;
-       IoModeFilter = 0; // default command & input
-       PrefixIoModeFilter = 3; // no prefix
+       PrefixTimeFormat = PREFIX_TIME_FORMAT_UNIX_EPOCH;
+       IoModeFilter = DIARY_FILTER_INPUT_AND_OUTPUT; // default command & input
+       PrefixIoModeFilter = PREFIX_FILTER_NONE; // no prefix
 
        if (_mode == 0)
        {
@@ -107,11 +107,11 @@ void Diary::write(std::wstring _wstr, bool bInput)
 
                        if (bInput) // input
                        {
-                               if ( (IoModeFilter == 0) || (IoModeFilter == 1) )
+                               if ( (IoModeFilter == DIARY_FILTER_INPUT_AND_OUTPUT) || (IoModeFilter == DIARY_FILTER_ONLY_INPUT) )
                                {
-                                       if ( (PrefixIoModeFilter == 0) || (PrefixIoModeFilter == 1) )
+                                       if ( (PrefixIoModeFilter == PREFIX_FILTER_INPUT_AND_OUTPUT) || (PrefixIoModeFilter == PREFIX_FILTER_ONLY_INPUT) )
                                        {
-                                               char *timeInfo = wide_string_to_UTF8((wchar_t*)getDiaryDate(Prefixmode).c_str());
+                                               char *timeInfo = wide_string_to_UTF8((wchar_t*)getDiaryDate(PrefixTimeFormat).c_str());
                                                if (timeInfo) 
                                                {
                                                        fileDiary << timeInfo << " ";
@@ -123,11 +123,11 @@ void Diary::write(std::wstring _wstr, bool bInput)
                        }
                        else // output
                        {
-                               if ( (IoModeFilter == 0) || (IoModeFilter == 2) )
+                               if ( (IoModeFilter == DIARY_FILTER_INPUT_AND_OUTPUT) || (IoModeFilter == DIARY_FILTER_ONLY_OUTPUT) )
                                {
-                                       if ( (PrefixIoModeFilter == 0) || (PrefixIoModeFilter == 2) )
+                                       if ( (PrefixIoModeFilter == PREFIX_FILTER_INPUT_AND_OUTPUT) || (PrefixIoModeFilter == PREFIX_FILTER_ONLY_OUTPUT) )
                                        {
-                                               char *timeInfo = wide_string_to_UTF8((wchar_t*)getDiaryDate(Prefixmode).c_str());
+                                               char *timeInfo = wide_string_to_UTF8((wchar_t*)getDiaryDate(PrefixTimeFormat).c_str());
                                                if (timeInfo) 
                                                {
                                                        fileDiary << timeInfo << " ";
@@ -189,32 +189,32 @@ std::wstring Diary::replace(std::wstring text, std::wstring s, std::wstring repl
        return text;
 }
 /*--------------------------------------------------------------------------*/ 
-int Diary::getIOMode(void)
+diary_filter Diary::getIOMode(void)
 {
        return IoModeFilter;
 }
 /*--------------------------------------------------------------------------*/ 
-void Diary::setIOMode(int _mode)
+void Diary::setIOMode(diary_filter _mode)
 {
        IoModeFilter = _mode;
 }
 /*--------------------------------------------------------------------------*/ 
-void Diary::setPrefixMode(int iPrefixMode)
+void Diary::setPrefixMode(diary_prefix_time_format iPrefixTimeFormat)
 {
-       Prefixmode = iPrefixMode;
+       PrefixTimeFormat = iPrefixTimeFormat;
 }
 /*--------------------------------------------------------------------------*/ 
-void Diary::setPrefixIoModeFilter(int mode)
+void Diary::setPrefixIoModeFilter(diary_prefix_time_filter mode)
 {
        PrefixIoModeFilter = mode;
 }
 /*--------------------------------------------------------------------------*/ 
-int Diary::getPrefixMode(void)
+diary_prefix_time_format Diary::getPrefixMode(void)
 {
-       return Prefixmode;
+       return PrefixTimeFormat;
 }
 /*--------------------------------------------------------------------------*/ 
-int Diary::getPrefixIoModeFilter(void)
+diary_prefix_time_filter Diary::getPrefixIoModeFilter(void)
 {
        return PrefixIoModeFilter;
 }