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

Unified Diff: installer/src/installer-lib/record.h

Issue 22887001: Custom action library, initial version (Closed)
Patch Set: Created Oct. 28, 2013, 9:37 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
Index: installer/src/installer-lib/record.h
===================================================================
new file mode 100644
--- /dev/null
+++ b/installer/src/installer-lib/record.h
@@ -0,0 +1,72 @@
+/**
+ * \file session.h The "install session" is the context for all custom installation behavior.
+ */
+
+#ifndef RECORD_H
+#define RECORD_H
+
+#include <string>
+#include "windows.h"
+#include "msi.h"
+
+/**
+ * An abstract record entity.
+ * It represents both records in the installation database and as argument vectors for API functions.
+ *
+ * The ordinary constructor creates a free-standing record.
+ * It takes only the number of fields in the created record.
+ * The fields of the record are dynamically typed according to how they're assigned.
+ *
+ * Other constructors encapsulate records that are bound to databases.
+ *
+ * \par Invariant
+ * - _handle is not null
+ * - _handle is represents an open record obtained from MsiCreateRecord
+ *
+ * \sa http://msdn.microsoft.com/en-us/library/windows/desktop/aa372881%28v=vs.85%29.aspx
+ * Windows Installer on MSDN: "Working with Records"
+ */
+class Record {
+public:
+ /**
+ * Ordinary constructor creates a free-standing record.
+ * Use this for creating argument vectors.
+ *
+ * \param[in] n_fields
+ * Number of fields in the created record.
+ */
+ Record( unsigned int n_fields ) ;
+
+ /**
+ * Destructor
+ */
+ ~Record() ;
+
+ /**
+ * Assign a string to a record
+ *
+ * \param[in] field_index
+ * Index into the record as a vector of fields
+ * \param[in] value
+ * String to write into the field
+ */
+ void assign_string( unsigned int field_index, std::wstring value ) ;
+
+ /**
+ * Handle accessor.
+ */
+ MSIHANDLE handle() { return _handle ; }
+
+private:
+ /**
+ * The handle for the record as a Windows Installer resource.
+ */
+ MSIHANDLE _handle ;
+
+ /**
+ * The number of fields in the record.
+ */
+ unsigned int n_fields ;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld