Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[project @ 2004-05-04 22:50:15 by nolan]

git-svn-id: file:///home/svn/MyPasswordSafe/trunk@4 9e3857e0-fc33-0410-b652-94ab0348a082
  • Loading branch information...
commit bb259bb9b3129bebfd3339e0b0b61ad01c1d23f7 1 parent 8756832
nolan authored
View
BIN  examples/attr
Binary file not shown
View
38 examples/attr.cpp
@@ -0,0 +1,38 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#define ATTRIBUTE(type, name) \
+public: \
+inline const type &name() const { return m_##name; } \
+inline void set_##name(const type &v) { m_##name = v; } \
+private: \
+type m_##name
+
+class Test
+{
+ ATTRIBUTE(int, age);
+ ATTRIBUTE(string, name);
+
+public:
+ Test(int age, const char *name)
+ : m_age(age), m_name(name)
+ {
+ }
+};
+
+int main()
+{
+ Test t(20, "Hello");
+ int age;
+ cin >> age;
+ string name;
+ cin >> name;
+
+ t.set_age(age);
+ t.set_name(name);
+ cout << t.age() << "\t" << t.name() << endl;
+
+ return 0;
+}
View
BIN  examples/safe
Binary file not shown
View
33 examples/safe.cpp
@@ -0,0 +1,33 @@
+#include <iostream>
+#include "safe.hpp"
+
+using namespace std;
+//using namepsace semanticgap::myps;
+
+int main(int argc, char *argv[])
+{
+ Safe safe;
+ string path;
+ string filter;
+ string password;
+ Safe::Error error_code = Safe::Failed;
+
+ cout << "File? ";
+ getline(cin, path, '\n');
+ cout << SafeSerializer::getTypes();
+ cout << "Filter?" << endl;
+ getline(cin, filter, '\n');
+ cout << "Password? ";
+ getline(cin, password, '\n');
+
+ error_code = safe.load(path.c_str(), filter.c_str(), EncryptedString(password), "nolan");
+ if(error_code != Safe::Success) {
+ cout << "Error: " << error_code << endl;
+ return 0;
+ }
+
+ cout << endl << "Safe opened" << endl;
+ // print entries
+
+ return 0;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.