Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: installer/src/installer-lib/session.cpp

Issue 5992177905696768: Issue #1186 - Rename symbols defined in 'installer-lib' (Closed)
Patch Set: fixed issues; rebased; new fixes from rebase Created June 19, 2015, 4:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « installer/src/installer-lib/session.h ('k') | installer/src/installer-lib/test/database_test.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: installer/src/installer-lib/session.cpp
===================================================================
--- a/installer/src/installer-lib/session.cpp
+++ b/installer/src/installer-lib/session.cpp
@@ -6,91 +6,91 @@
#include "session.h"
#include "property.h"
#include "msiquery.h"
-
-//-----------------------------------------------------------------------------------------
-// Message
-//-----------------------------------------------------------------------------------------
-Message::Message( std::string message, INSTALLMESSAGE message_type )
- : r( 1 ), message_type( message_type )
-{
- r.assign_string( 0, message ) ;
-}
-
-Message::Message( std::wstring message, INSTALLMESSAGE message_type )
- : r( 1 ), message_type( message_type )
-{
- r.assign_string( 0, message ) ;
-}
-
-//-----------------------------------------------------------------------------------------
-// Session
-//-----------------------------------------------------------------------------------------
-Session::Session( MSIHANDLE handle, std::string name )
- : handle( handle ),
- log_prefix( name + ": " )
-{
- log_prefix_w.assign( name.begin(), name.end() ) ;
- log_prefix_w += L": " ;
- LogNoexcept( "Entering custom action" ) ;
-}
-
-Session::~Session()
-{
- LogNoexcept( "Exiting custom action" ) ;
-}
-
-/**
-* A message for the installation log.
-*
-* Writing to the installation log uses MsiProcessMessage just like interactive dialog boxes do.
-*
-* This class is not exposed outside this compilation unit because everything it can do is already exposed by the log functions.
-*/
-struct Log_Message
- : public Message
-{
- Log_Message ( std::wstring message )
- : Message( message, INSTALLMESSAGE_INFO )
- {}
-
- Log_Message ( std::string message )
- : Message( message, INSTALLMESSAGE_INFO )
- {}
-} ;
-
-void Session::Log( std::string message )
-{
- WriteMessage( Log_Message( log_prefix + message ) ) ;
-}
-
-void Session::Log( std::wstring message )
-{
- WriteMessage( Log_Message( log_prefix_w + message ) ) ;
-}
-
-void Session::LogNoexcept( std::string message )
-{
- write_message_noexcept( Log_Message( log_prefix + message ) ) ;
-}
-
-int Session::WriteMessage( Message & m )
-{
- int x = write_message_noexcept( m ) ;
- if ( x == -1 )
- {
- throw windows_api_error( "MsiProcessMessage", x, "attempt to write to log file" ) ;
- }
- return x ;
-}
-
-int Session::write_message_noexcept( Message & m )
-{
- return MsiProcessMessage( handle, m.message_type, m.r.handle() ) ;
-}
-
-//-----------------------------------------------------------------------------------------
-// ImmediateSession
-//-----------------------------------------------------------------------------------------
-ImmediateSession::ImmediateSession( MSIHANDLE handle, std::string name )
- : Session( handle, name )
-{}
+
+//-----------------------------------------------------------------------------------------
+// Message
+//-----------------------------------------------------------------------------------------
+Message::Message( std::string message, INSTALLMESSAGE messageType )
+ : r( 1 ), MessageTypeCode( messageType )
+{
+ r.AssignString( 0, message ) ;
+}
+
+Message::Message( std::wstring message, INSTALLMESSAGE messageType )
+ : r( 1 ), MessageTypeCode( messageType )
+{
+ r.AssignString( 0, message ) ;
+}
+
+//-----------------------------------------------------------------------------------------
+// Session
+//-----------------------------------------------------------------------------------------
+Session::Session( MSIHANDLE handle, std::string name )
+ : handle( handle ),
+ logPrefix( name + ": " )
+{
+ logPrefixW.assign( name.begin(), name.end() ) ;
+ logPrefixW += L": " ;
+ LogNoexcept( "Entering custom action" ) ;
+}
+
+Session::~Session()
+{
+ LogNoexcept( "Exiting custom action" ) ;
+}
+
+/**
+* A message for the installation log.
+*
+* Writing to the installation log uses MsiProcessMessage just like interactive dialog boxes do.
+*
+* This class is not exposed outside this compilation unit because everything it can do is already exposed by the log functions.
+*/
+struct LogMessage
+ : public Message
+{
+ LogMessage ( std::wstring message )
+ : Message( message, INSTALLMESSAGE_INFO )
+ {}
+
+ LogMessage ( std::string message )
+ : Message( message, INSTALLMESSAGE_INFO )
+ {}
+} ;
+
+void Session::Log( std::string message )
+{
+ WriteMessage( LogMessage( logPrefix + message ) ) ;
+}
+
+void Session::Log( std::wstring message )
+{
+ WriteMessage( LogMessage( logPrefixW + message ) ) ;
+}
+
+void Session::LogNoexcept( std::string message )
+{
+ WriteMessageNoexcept( LogMessage( logPrefix + message ) ) ;
+}
+
+int Session::WriteMessage( Message & m )
+{
+ int x = WriteMessageNoexcept( m ) ;
+ if ( x == -1 )
+ {
+ throw WindowsApiError( "MsiProcessMessage", x, "attempt to write to log file" ) ;
+ }
+ return x ;
+}
+
+int Session::WriteMessageNoexcept( Message & m )
+{
+ return MsiProcessMessage( handle, m.MessageTypeCode, m.r.Handle() ) ;
+}
+
+//-----------------------------------------------------------------------------------------
+// ImmediateSession
+//-----------------------------------------------------------------------------------------
+ImmediateSession::ImmediateSession( MSIHANDLE handle, std::string name )
+ : Session( handle, name )
+{}
« no previous file with comments | « installer/src/installer-lib/session.h ('k') | installer/src/installer-lib/test/database_test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld