亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? extractcode.cpp

?? Thingking_in_C++配套書籍例子代碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
//: C10:ExtractCode.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
// Automatically extracts code files from
// ASCII text of this book.
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

string copyright =
  "// From Thinking in C++, 2nd Edition\n"
  "// Available at http://www.BruceEckel.com\n"
  "// (c) Bruce Eckel 1999\n"
  "// Copyright notice in Copyright.txt\n";

string usage =
  " Usage:ExtractCode source\n"
  "where source is the ASCII file containing \n"
  "the embedded tagged sourcefiles. The ASCII \n"
  "file must also contain an embedded compiler\n"
  "configuration file called CompileDB.txt \n"
  "See Thinking in C++, 2nd ed. for details\n";

// Tool to remove the white space from both ends:
string trim(const string& s) {
  if(s.length() == 0)
    return s;
  int b = s.find_first_not_of(" \t");
  int e = s.find_last_not_of(" \t");
  if(b == -1) // No non-spaces
    return "";
  return string(s, b, e - b + 1);
}

// Manage all the error messaging:
void error(string problem, string message) {
  static const string border(
  "-----------------------------------------\n");
  class ErrReport {
    int count;
    string fname;
  public:
    ofstream errs;
    ErrReport(char* fn = "ExtractCodeErrors.txt") 
      : count(0),fname(fn),errs(fname.c_str()) {}
    void operator++(int) { count++; }
    ~ErrReport() {
      errs.close();
      // Dump error messages to console
      ifstream in(fname.c_str());
      cerr << in.rdbuf() << endl;
      cerr << count << " Errors found" << endl;
      cerr << "Messages in " << fname << endl;
    }
  };
  // Created on first call to this function;
  // Destructor reports total errors:
  static ErrReport report;
  report++;
  report.errs << border << message << endl
    << "Problem spot: " << problem << endl;
}

///// OS-specific code, hidden inside a class:
#ifdef __GNUC__  // For gcc under Linux/Unix
#include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
class OSDirControl {
public:
  static string getCurrentDir() {
    char path[PATH_MAX];
    getcwd(path, PATH_MAX);
    return string(path);
  }
  static void makeDir(string dir) {
    mkdir(dir.c_str(), 0777);
  }
  static void changeDir(string dir) {
    chdir(dir.c_str());
  }
};
#else // For Dos/Windows:
#include <direct.h>
class OSDirControl {
public:
  static string getCurrentDir() {
    char path[_MAX_PATH];
    getcwd(path, _MAX_PATH);
    return string(path);
  }
  static void makeDir(string dir) {
    mkdir(dir.c_str());
  }
  static void changeDir(string dir) {
    chdir(dir.c_str());
  }
};
#endif ///// End of OS-specific code

class PushDirectory {
  string oldpath;
public:
  PushDirectory(string path);
  ~PushDirectory() {
    OSDirControl::changeDir(oldpath);
  }
  void pushOneDir(string dir) {
    OSDirControl::makeDir(dir);
    OSDirControl::changeDir(dir);
  }
};

PushDirectory::PushDirectory(string path) {
  oldpath = OSDirControl::getCurrentDir();
  while(path.length() != 0) {
    int colon = path.find(':');
    if(colon != string::npos) {
      pushOneDir(path.substr(0, colon));
      path = path.substr(colon + 1);
    } else {
      pushOneDir(path);
      return;
    }
  }
}

//--------------- Manage code files -------------
// A CodeFile object knows everything about a
// particular code file, including contents, path
// information, how to compile, link, and test 
// it, and which compilers it won't compile with.
enum TType {header, object, executable, none};

class CodeFile {
  TType _targetType;
  string _rawName, // Original name from input
    _path, // Where the source file lives
    _file, // Name of the source file
    _base, // Name without extension
    _tname, // Target name
    _testArgs; // Command-line arguments
  vector<string>
    lines, // Contains the file
    _compile, // Compile dependencies
    _link; // How to link the executable
  set<string>
    _noBuild; // Compilers it won't compile with
  bool writeTags; // Whether to write the markers
  // Initial makefile processing for the file:
  void target(const string& s);
  // For quoted #include headers:
  void headerLine(const string& s);
  // For special dependency tag marks:
  void dependLine(const string& s);
public:
  CodeFile(istream& in, string& s);
  const string& rawName() { return _rawName; }
  const string& path() { return _path; }
  const string& file() { return _file; }
  const string& base() { return _base; }
  const string& targetName() { return _tname; }
  TType targetType() { return _targetType; }
  const vector<string>& compile() {
    return _compile;
  }
  const vector<string>& link() {
    return _link;
  }
  const set<string>& noBuild() {
    return _noBuild;
  }
  const string& testArgs() { return _testArgs; }
  // Add a compiler it won't compile with:
  void addFailure(const string& failure) {
    _noBuild.insert(failure);
  }
  bool compilesOK(string compiler) {
    return _noBuild.count(compiler) == 0;
  }
  friend ostream&
  operator<<(ostream& os, const CodeFile& cf) {
    copy(cf.lines.begin(), cf.lines.end(),
      ostream_iterator<string>(os, ""));
    return os;
  }
  void write() {
    PushDirectory pd(_path);
    ofstream listing(_file.c_str());
    listing << *this;  // Write the file
  }
  void dumpInfo(ostream& os);
};

void CodeFile::target(const string& s) {
  // Find the base name of the file (without
  // the extension):
  int lastDot = _file.find_last_of('.');
  if(lastDot == string::npos) {
    error(s, "Missing extension");
    exit(1);
  }
  _base = _file.substr(0, lastDot);
  // Determine the type of file and target:
  if(s.find(".h") != string::npos ||
     s.find(".H") != string::npos) {
    _targetType = header;
    _tname = _file;
    return;
  }
  if(s.find(".txt") != string::npos
      || s.find(".TXT") != string::npos
      || s.find(".dat") != string::npos
      || s.find(".DAT") != string::npos) {
    // Text file, not involved in make
    _targetType = none;
    _tname = _file;
    return;
  }
  // C++ objs/exes depend on their own source:
  _compile.push_back(_file);
  if(s.find("{O}") != string::npos) {
    // Don't build an executable from this file
    _targetType = object;
    _tname = _base;
  } else {
    _targetType = executable;
    _tname = _base;
    // The exe depends on its own object file:
    _link.push_back(_base);
  }
}

void CodeFile::headerLine(const string& s) {
  int start = s.find('\"');
  int end = s.find('\"', start + 1);
  int len = end - start - 1;
  _compile.push_back(s.substr(start + 1, len));
}

void CodeFile::dependLine(const string& s) {
  const string linktag("//{L} ");
  string deps = trim(s.substr(linktag.length()));
  while(true) {
    int end = deps.find(' ');
    string dep = deps.substr(0, end);
    _link.push_back(dep);
    if(end == string::npos) // Last one
      break;
    else
      deps = trim(deps.substr(end));
  }
}

CodeFile::CodeFile(istream& in, string& s) {
  // If false, don't write begin & end tags:
  writeTags = (s[3] != '!');
  // Assume a space after the starting tag:
  _file = s.substr(s.find(' ') + 1);
  // There will always be at least one colon:
  int lastColon = _file.find_last_of(':');
  if(lastColon == string::npos) {
    error(s, "Missing path");
    lastColon = 0; // Recover from error
  }
  _rawName = trim(_file);
  _path = _file.substr(0, lastColon);
  _file = _file.substr(lastColon + 1);
  _file =_file.substr(0,_file.find_last_of(' '));
  cout << "path = [" << _path << "] "
    << "file = [" << _file << "]" << endl;
  target(s); // Determine target type
  if(writeTags){
    lines.push_back(s + '\n');
    lines.push_back(copyright);
  }
  string s2;
  while(getline(in, s2)) {
    // Look for specified link dependencies:
    if(s2.find("//{L}") == 0) // 0: Start of line
      dependLine(s2);
    // Look for command-line arguments for test:
    if(s2.find("//{T}") == 0) // 0: Start of line
      _testArgs = s2.substr(strlen("//{T}") + 1);
    // Look for quoted includes:
    if(s2.find("#include \"") != string::npos) {
      headerLine(s2); // Grab makefile info
    }
    // Look for end marker:
    if(s2.find("//" "/:~") != string::npos) {
      if(writeTags)
        lines.push_back(s2 + '\n');
      return;  // Found the end
    }
    // Make sure you don't see another start:
    if(s2.find("//" ":") != string::npos
       || s2.find("/*" ":") != string::npos) {
      error(s, "Error: new file started before"
        " previous file concluded");
      return;
    }
    // Write ordinary line:
    lines.push_back(s2 + '\n');
  }
}

void CodeFile::dumpInfo(ostream& os) {
  os << _path << ':' << _file << endl;
  os << "target: " << _tname << endl;
  os << "compile: " << endl;
  for(int i = 0; i < _compile.size(); i++)
    os << '\t' << _compile[i] << endl;
  os << "link: " << endl;
  for(int i = 0; i < _link.size(); i++)
    os << '\t' << _link[i] << endl;
  if(_noBuild.size() != 0) {
    os << "Won't build with: " << endl;
    copy(_noBuild.begin(), _noBuild.end(),
      ostream_iterator<string>(os, "\n"));
  }
}

//--------- Manage compiler information ---------
class CompilerData {
  // Information about each compiler:
  vector<string> rules; // Makefile rules
  set<string> fails; // Non-compiling files
  string objExtension; // File name extensions
  string exeExtension;
  // For OS-specific activities:
  bool _dos, _unix;
  // Store the information for all the compilers:
  static map<string, CompilerData> compilerInfo;
  static set<string> _compilerNames;
public:
  CompilerData() : _dos(false), _unix(false) {}
  // Read database of various compiler's 
  // information and failure listings for 
  // compiling the book files:
  static void readDB(istream& in);
  // For enumerating all the compiler names:
  static set<string>& compilerNames() {
    return _compilerNames;
  }
  // Tell this CodeFile which compilers
  // don't work with it:
  static void addFailures(CodeFile& cf);
  // Produce the proper object file name
  // extension for this compiler:
  static string obj(string compiler);
  // Produce the proper executable file name
  // extension for this compiler:
  static string exe(string compiler);
  // For inserting a particular compiler's
  // rules into a makefile:
  static void 
  writeRules(string compiler, ostream& os);
  // Change forward slashes to backward 
  // slashes if necessary:
  static string 
  adjustPath(string compiler, string path);
  // So you can ask if it's a Unix compiler:
  static bool isUnix(string compiler) {
    return compilerInfo[compiler]._unix;
  }
  // So you can ask if it's a dos compiler:
  static bool isDos(string compiler) {
    return compilerInfo[compiler]._dos;
  }
  // Display information (for debugging):
  static void dump(ostream& os = cout);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区国产| **性色生活片久久毛片| 天天综合天天综合色| 色av一区二区| 亚洲丝袜制服诱惑| 色综合欧美在线| 天天免费综合色| 日韩午夜精品视频| 国产寡妇亲子伦一区二区| 国产精品国产三级国产| 色一情一乱一乱一91av| 日韩精品一级中文字幕精品视频免费观看| 日韩视频一区二区三区在线播放| 久久99热这里只有精品| 国产精品久久久久久久裸模| 色婷婷综合视频在线观看| 视频在线在亚洲| 日韩精品一区二区三区视频在线观看| 国产毛片精品一区| 亚洲女人****多毛耸耸8| 91九色最新地址| 精品一区二区三区影院在线午夜| 国产精品久久看| 欧美日韩在线一区二区| 国产一区久久久| 亚洲精品成a人| 日韩一区二区视频在线观看| 高清不卡一区二区| 一区二区三区在线免费视频| 日韩午夜三级在线| 91麻豆swag| 蜜臀久久99精品久久久画质超高清| 欧美经典三级视频一区二区三区| 91激情在线视频| 狠狠色丁香久久婷婷综合丁香| 亚洲乱码国产乱码精品精小说| 国产精品不卡在线观看| 欧美日免费三级在线| 国产一区二区在线视频| 亚洲小少妇裸体bbw| 久久久久久久久久美女| 欧美精品自拍偷拍| www.亚洲精品| 国内久久婷婷综合| 亚洲一区二区三区四区五区黄| 欧美激情一区在线观看| 欧美一区二区网站| 在线精品国精品国产尤物884a| 国产剧情一区二区三区| 日韩av高清在线观看| 一区二区三区蜜桃网| 中文一区在线播放| 精品国产123| 91精品国产91综合久久蜜臀| 色综合久久久久综合| 国产不卡视频一区| 激情深爱一区二区| 日韩av一区二| 日韩激情av在线| 亚洲精品成人少妇| 亚洲日本护士毛茸茸| 欧美激情综合五月色丁香小说| 日韩欧美国产小视频| 欧美精品日韩精品| 一本久道久久综合中文字幕| 成人久久视频在线观看| 国产精品一二三四五| 日本视频在线一区| 视频一区中文字幕国产| 一区二区欧美国产| 亚洲美女少妇撒尿| 亚洲另类春色国产| 亚洲另类在线一区| 亚洲黄色片在线观看| 亚洲人成7777| 亚洲最快最全在线视频| 久草精品在线观看| 激情久久五月天| 国内精品伊人久久久久影院对白| 日本欧美加勒比视频| 日本成人超碰在线观看| 美女一区二区三区在线观看| 蜜臀国产一区二区三区在线播放| 久久精品免费观看| 久久成人av少妇免费| 精品一区中文字幕| 国产91对白在线观看九色| 国产一区二区网址| 成人精品电影在线观看| av电影在线观看一区| 色综合视频一区二区三区高清| 在线视频一区二区免费| 欧美色区777第一页| 欧美肥妇bbw| 久久久三级国产网站| 国产网站一区二区| 亚洲特黄一级片| 无吗不卡中文字幕| 国产一区二区三区最好精华液| 成人精品高清在线| 在线一区二区三区| 欧美一级xxx| 蜜臀久久99精品久久久久宅男| 国产一区二区精品久久99| 久久99国内精品| 97精品视频在线观看自产线路二| 99久久免费精品| 91日韩在线专区| 色域天天综合网| 欧美性xxxxxx少妇| 欧美日韩在线综合| 欧美一区二区三区在线| 久久色.com| 亚洲国产成人在线| 一级做a爱片久久| 麻豆一区二区三区| 9人人澡人人爽人人精品| 欧美日韩一二三区| 久久综合国产精品| 亚洲一区二区三区在线| 久久国产综合精品| 91小视频在线| 精品国产欧美一区二区| 亚洲日穴在线视频| 韩日欧美一区二区三区| 92国产精品观看| 日韩欧美国产麻豆| 亚洲精品大片www| 国产精一区二区三区| 欧美精品久久99久久在免费线| 国产欧美1区2区3区| 日本aⅴ亚洲精品中文乱码| thepron国产精品| 久久这里只精品最新地址| 香蕉久久夜色精品国产使用方法 | 精品国产免费久久| 亚洲人吸女人奶水| 国内偷窥港台综合视频在线播放| 欧美亚洲日本一区| 亚洲国产精品99久久久久久久久 | 国精产品一区一区三区mba视频| 99精品国产热久久91蜜凸| 日韩精品一区二区三区视频在线观看| 亚洲日本在线观看| 顶级嫩模精品视频在线看| 日韩精品中文字幕在线不卡尤物| 亚洲女人的天堂| 成人av网址在线| 久久久影院官网| 精品一区二区三区在线播放 | 亚洲成人先锋电影| 成人美女在线观看| 久久精品在线免费观看| 奇米一区二区三区av| 欧美亚洲综合另类| 亚洲黄色小视频| 色综合欧美在线视频区| 亚洲欧美国产毛片在线| av午夜精品一区二区三区| 国产三级精品三级在线专区| 国内精品在线播放| 精品欧美一区二区三区精品久久| 亚洲 欧美综合在线网络| 欧美色大人视频| 亚洲电影一级片| 欧美日韩国产小视频| 亚洲成人福利片| 欧美日韩日日摸| 午夜av区久久| 91麻豆精品国产91久久久久久| 午夜视频一区二区| 欧美精品九九99久久| 人人爽香蕉精品| 日韩一区二区三区视频| 免费成人美女在线观看.| 精品久久久久久综合日本欧美| 久久精品国产久精国产爱| 日韩精品一区二区三区四区视频| 精品一区二区三区免费观看 | 国产欧美日韩卡一| 成人av电影在线播放| 亚洲天天做日日做天天谢日日欢 | 欧美一二区视频| 激情都市一区二区| 国产视频在线观看一区二区三区| 成人一区二区三区视频在线观看| 中文字幕在线观看不卡视频| 色综合一区二区| 日产国产欧美视频一区精品| 久久综合色天天久久综合图片| 国产91露脸合集magnet| 中文字幕一区二区不卡 | 在线区一区二视频| 日韩av一区二区三区| 日韩你懂的在线观看| 成人性生交大片免费看视频在线 | 精品国产网站在线观看| 国产福利一区二区三区视频在线| 中文字幕一区二区三区在线不卡| 欧美日韩精品一区视频|