📄 cons_03.cc
字号:
// file: $isip/class/system/Console/cons_03.cc// version: $Id: cons_03.cc,v 1.2 2000/09/20 12:51:47 hamaker Exp $//// isip include files//#include "Console.h"#include <SysString.h>// method: open//// arguments:// const unichar* filename: (input) file to open// MODE mode: (input) open mode//// return: a boolean value indicating status//// open the file//boolean Console::open(const unichar* filename_a, MODE mode_a) { SysString temp(filename_a); // call the master function // return open(temp, mode_a);}// method: open//// arguments:// const SysString& filename: (input) file to open// MODE mode: (input) open mode//// return: a boolean value indicating status//// open the file to be the new console, push the current console// pointer into the stack//boolean Console::open(const SysString& filename_a, MODE mode_a) { // open the new console // File new_cons; if (!new_cons.open(filename_a, mode_a)) { return Error::handle(name(), L"open", Error::IO, __FILE__, __LINE__); } if (!new_cons.isWritable()) { return Error::handle(name(), L"open", Error::IO, __FILE__, __LINE__); } // set the new console's line wrap // new_cons.setLineWrap(DEF_LINE_WRAP); // push the current console onto the stack // if (!push(cons_d)) { return Error::handle(name(), L"open", Error::IO, __FILE__, __LINE__); } // start using the new console, then exit // return cons_d.swap(new_cons);}// method: open//// arguments:// STREAM stream: (input) file stream//// return: a boolean value indicating status//// this is stream open command//boolean Console::open(STREAM stream_a) { // open the new console // File new_cons(stream_a); if (!new_cons.isWritable()) { return Error::handle(name(), L"open", Error::IO, __FILE__, __LINE__); } // set the new console's line wrap // new_cons.setLineWrap(DEF_LINE_WRAP); // push the current console onto the stack // if (!push(cons_d)) { return Error::handle(name(), L"open", Error::IO, __FILE__, __LINE__); } // start using the new console, then exit // return cons_d.swap(new_cons);}// method: close//// arguments: none//// return: a boolean value indicating status//// close the file//boolean Console::close() { // local variables // File top; File backup; // pop the stack // if (!pop(top)) { return Error::handle(name(), L"close", Error::IO, __FILE__, __LINE__); } // save cons_d while we close backup // if (!backup.swap(cons_d)) { return Error::handle(name(), L"close", Error::IO, __FILE__, __LINE__); } // assign the new pointer // if (!cons_d.swap(top)) { return Error::handle(name(), L"close", Error::IO, __FILE__, __LINE__); } // close the old console safely // if (!backup.close()) { return Error::handle(name(), L"close", Error::IO, __FILE__, __LINE__); } // exit gracefully // return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -