Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(920)

Unified Diff: runtime/bin/utils.h

Issue 9630012: Error reporting on File in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Style issues Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/io_sources.gypi ('k') | runtime/bin/utils_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/utils.h
diff --git a/runtime/bin/utils.h b/runtime/bin/utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8f77661a257d194abb0265847fa88755b467a40
--- /dev/null
+++ b/runtime/bin/utils.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef BIN_UTILS_H_
+#define BIN_UTILS_H_
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "include/dart_api.h"
+#include "platform/globals.h"
+
+class OSError {
+ public:
+ OSError();
+ OSError(int code, char* message) {
+ code_ = code;
+ SetMessage(message);
+ }
+ virtual ~OSError() { free(message_); }
+
+ int code() { return code_; }
+ void set_code(int code) { code_ = code; }
+ char* message() { return message_; }
+ void SetMessage(char* message) {
+ free(message_);
+ if (message == NULL) {
+ message_ = NULL;
+ } else {
+ message_ = strdup(message);
+ }
+ }
+
+ private:
+ int code_;
+ char* message_;
+
+ DISALLOW_COPY_AND_ASSIGN(OSError);
+};
+
+#endif // BIN_UTILS_H_
« no previous file with comments | « runtime/bin/io_sources.gypi ('k') | runtime/bin/utils_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698