[commit] r1496 - trunk/SDK/BON/Common
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu Sep 1 10:50:27 CDT 2011
Author: ksmyth
Date: Thu Sep 1 10:50:27 2011
New Revision: 1496
Log:
Refactor
Modified:
trunk/SDK/BON/Common/Console.cpp
trunk/SDK/BON/Common/Console.h
Modified: trunk/SDK/BON/Common/Console.cpp
==============================================================================
--- trunk/SDK/BON/Common/Console.cpp Thu Sep 1 10:02:46 2011 (r1495)
+++ trunk/SDK/BON/Common/Console.cpp Thu Sep 1 10:50:27 2011 (r1496)
@@ -1,7 +1,7 @@
#include "stdafx.h"
#include "Console.h"
-
+#include "Gme.h"
namespace GMEConsole
{
@@ -22,4 +22,73 @@
}
}
}
-}
\ No newline at end of file
+ void Console::ReleaseConsole() {
+ if (gmeoleapp)
+ gmeoleapp.Release();
+ }
+
+ void Console::WriteLine(const CString& message, msgtype_enum type)
+ {
+ if (gmeoleapp == 0) {
+ switch (type) {
+ case MSG_NORMAL:
+ case MSG_INFO:
+ case MSG_WARNING:
+ _tprintf(_T("%s\n"), message);
+ break;
+ case MSG_ERROR:
+ _ftprintf(stderr, _T("%s\n"), message);
+ break;
+ }
+ }
+ else {
+ COMTHROW(gmeoleapp->ConsoleMessage( CComBSTR(message.GetLength(),message),type));
+ }
+ }
+
+ void Console::Clear()
+ {
+ if (gmeoleapp != 0) {
+ CComBSTR empty(L"");
+ COMTHROW(gmeoleapp->put_ConsoleContents(empty));
+ }
+ }
+
+ void Console::SetContents(const CString& contents)
+ {
+ if (gmeoleapp != 0) {
+ COMTHROW(gmeoleapp->put_ConsoleContents( CComBSTR(contents.GetLength(),contents)));
+ }
+ }
+
+ void Console::NavigateTo(const CString& url)
+ {
+ if (gmeoleapp != 0) {
+ COMTHROW(gmeoleapp->ConsoleNavigateTo(CComBSTR(url.GetLength(), url)));
+ }
+ }
+
+ void Console::Error::WriteLine(const CString& message)
+ {
+ Console::WriteLine(message,MSG_ERROR);
+ }
+
+ void Console::Out::WriteLine(const CString& message)
+ {
+ Console::WriteLine(message, MSG_NORMAL);
+ }
+ void Console::Warning::WriteLine(const CString& message)
+ {
+ Console::WriteLine(message, MSG_WARNING);
+ }
+ void Console::Info::writeLine(const CString& message)
+ {
+ Console::WriteLine(message,MSG_INFO);
+ }
+ void Console::Info::WriteLine(const CString& message)
+ {
+ Console::WriteLine(message,MSG_INFO);
+ }
+}
+
+
Modified: trunk/SDK/BON/Common/Console.h
==============================================================================
--- trunk/SDK/BON/Common/Console.h Thu Sep 1 10:02:46 2011 (r1495)
+++ trunk/SDK/BON/Common/Console.h Thu Sep 1 10:50:27 2011 (r1496)
@@ -1,9 +1,10 @@
#pragma once
#include "ComHelp.h"
#include "GMECOM.h"
-#include "Gme.h"
-//#include "Formatter.h"
+struct IGMEOLEApp;
+struct IMgaProject;
+enum msgtype_enum;
namespace GMEConsole
{
@@ -14,88 +15,36 @@
static CComPtr<IGMEOLEApp> gmeoleapp;
static void SetupConsole(CComPtr<IMgaProject> project);
- static void ReleaseConsole() {
- if (gmeoleapp)
- gmeoleapp.Release();
- }
+ static void ReleaseConsole();
+ static void WriteLine(const CString& message, msgtype_enum type);
- static void WriteLine(const CString& message, msgtype_enum type=MSG_INFO)
- {
- if (gmeoleapp == 0) {
- switch (type) {
- case MSG_NORMAL:
- case MSG_INFO:
- case MSG_WARNING:
- _tprintf(_T("%s\n"), message);
- break;
- case MSG_ERROR:
- _ftprintf(stderr, _T("%s\n"), message);
- break;
- }
- }
- else {
- COMTHROW(gmeoleapp->ConsoleMessage( CComBSTR(message.GetLength(),message),type));
- }
- }
+ static void Clear();
- static void Clear()
- {
- if (gmeoleapp != 0) {
- CComBSTR empty(L"");
- COMTHROW(gmeoleapp->put_ConsoleContents(empty));
- }
- }
+ static void SetContents(const CString& contents);
- static void SetContents(const CString& contents)
- {
- if (gmeoleapp != 0) {
- COMTHROW(gmeoleapp->put_ConsoleContents( CComBSTR(contents.GetLength(),contents)));
- }
- }
-
- static void NavigateTo(const CString& url)
- {
- if (gmeoleapp != 0) {
- COMTHROW(gmeoleapp->ConsoleNavigateTo(CComBSTR(url.GetLength(), url)));
- }
- }
+ static void NavigateTo(const CString& url);
class Error
{
public:
- static void WriteLine(const CString& message)
- {
- Console::WriteLine(message,MSG_ERROR);
- }
+ static void WriteLine(const CString& message);
};
class Out
{
public:
- static void WriteLine(const CString& message)
- {
- Console::WriteLine(message, MSG_NORMAL);
- }
+ static void WriteLine(const CString& message);
};
class Warning
{
public:
- static void WriteLine(const CString& message)
- {
- Console::WriteLine(message, MSG_WARNING);
- }
+ static void WriteLine(const CString& message);
};
class Info
{
public:
- // deprecated
- static void writeLine(const CString& message)
- {
- Console::WriteLine(message,MSG_INFO);
- }
- static void WriteLine(const CString& message)
- {
- Console::WriteLine(message,MSG_INFO);
- }
+ static void WriteLine(const CString& message);
+ // deprecated:
+ static void writeLine(const CString& message);
};
};
}
\ No newline at end of file
More information about the gme-commit
mailing list