From: Ryan Date: Sat, 18 Apr 2009 12:34:30 +0000 (+0200) Subject: rename NewFile to File::New X-Git-Tag: v0.0.1~146 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=102c6399ac342018c376f850290686bc0d13562f;p=platform%2Fupstream%2Fnodejs.git rename NewFile to File::New --- diff --git a/src/file.cc b/src/file.cc index edb4e7b..b7a6579 100644 --- a/src/file.cc +++ b/src/file.cc @@ -18,6 +18,44 @@ using namespace v8; // In javascript it is called "File". static Persistent fs; +class FileSystem { +public: + static Handle Rename (const Arguments& args); + static int AfterRename (eio_req *req); + + static Handle Stat (const Arguments& args); + static int AfterStat (eio_req *req); + + static Handle StrError (const Arguments& args); +}; + +class File { +public: + File (Handle handle); + ~File (); + + static Handle New (const Arguments& args); + + static Handle Open (const Arguments& args); + static int AfterOpen (eio_req *req); + + static Handle Close (const Arguments& args); + static int AfterClose (eio_req *req); + + static Handle Write (const Arguments& args); + static int AfterWrite (eio_req *req); + + static Handle Read (const Arguments& args); + static int AfterRead (eio_req *req); + +private: + static File* Unwrap (Handle handle); + bool HasUtf8Encoding (void); + int GetFD (void); + static void MakeWeak (Persistent _, void *data); + Persistent handle_; +}; + static void CallTopCallback (Handle handle, const int argc, Handle argv[]) { @@ -57,44 +95,6 @@ InitActionQueue (Handle handle) handle->Set(ACTION_QUEUE_SYMBOL, Array::New()); } -class File { -public: - File (Handle handle); - ~File (); - - static File* Unwrap (Handle handle); - - static Handle Open (const Arguments& args); - static int AfterOpen (eio_req *req); - - static Handle Close (const Arguments& args); - static int AfterClose (eio_req *req); - - static Handle Write (const Arguments& args); - static int AfterWrite (eio_req *req); - - static Handle Read (const Arguments& args); - static int AfterRead (eio_req *req); - - -private: - bool HasUtf8Encoding (void); - Persistent handle_; - int GetFD (void); - static void MakeWeak (Persistent _, void *data); -}; - -class FileSystem { -public: - static Handle Rename (const Arguments& args); - static int AfterRename (eio_req *req); - - static Handle Stat (const Arguments& args); - static int AfterStat (eio_req *req); - - static Handle StrError (const Arguments& args); -}; - Handle FileSystem::Rename (const Arguments& args) { @@ -471,8 +471,8 @@ File::AfterRead (eio_req *req) return 0; } -static Handle -NewFile (const Arguments& args) +Handle +File::New(const Arguments& args) { HandleScope scope; File *file = new File(args.Holder()); @@ -490,7 +490,7 @@ NodeInit_file (Handle target) HandleScope scope; - Local file_template = FunctionTemplate::New(NewFile); + Local file_template = FunctionTemplate::New(File::New); file_template->InstanceTemplate()->SetInternalFieldCount(1); fs = Persistent::New(file_template->GetFunction());