Files
itgmania212121/stepmania/PBProject/Installer/Processor.h
T

63 lines
1.7 KiB
C++
Raw Normal View History

2003-09-08 20:20:57 +00:00
/*
* Processor.h
* stepmania
*
* Created by Steve Checkoway on Sun Sep 07 2003.
* Copyright (c) 2003 Steve Checkoway. All rights reserved.
*
*/
#ifndef PROCESSOR_H
#define PROCESSOR_H
using namespace std;
#include <stack>
#include <map>
#include <set>
2003-09-08 20:20:57 +00:00
#include "StdString.h"
class Processor
{
private:
2003-09-10 02:42:49 +00:00
typedef void (*handleFileFunc)(const CString& file, const CString& dir, const CString& archivePath,
bool overwrite);
2003-09-09 01:00:48 +00:00
typedef const CString (*getPathFunc)(const CString& ID);
2003-09-08 20:20:57 +00:00
typedef void (*errorFunc)(const char *fmt, ...);
2003-09-09 01:00:48 +00:00
typedef bool (*askFunc)(const CString& question);
typedef bool (*authFunc)(void);
typedef void (*echoFunc)(const CString& message, bool loud);
typedef void (*privFunc)(bool privileged);
2003-09-08 20:20:57 +00:00
stack<unsigned> mReturnStack;
bool mDoGoto;
CString mLabel;
map<CString, bool> mConditionals;
map<CString, CString> mVars;
map<CString, unsigned> mLabels;
set<CString> mIgnore;
2003-09-08 20:20:57 +00:00
CString mPath;
CString mCWD;
handleFileFunc mHandleFile;
getPathFunc mGetPath;
2003-09-09 01:00:48 +00:00
askFunc mAsk;
2003-09-08 20:20:57 +00:00
errorFunc mError;
authFunc mAuth;
echoFunc mEcho;
privFunc mPriv;
2003-09-08 20:20:57 +00:00
bool mInstalling;
const CString& ResolveVar(const CString& var);
bool ResolveConditional(const CString& cond);
static void DefaultError(const char *fmt, ...);
public:
2003-09-10 03:26:12 +00:00
Processor(CString& path, handleFileFunc f, getPathFunc p, askFunc a, bool i);
~Processor();
2003-09-08 20:20:57 +00:00
void ProcessLine(const CString& line, unsigned& nextLine);
void SetErrorFunc(errorFunc f) { mError = f; }
void SetAuthFunc(authFunc f) { mAuth = f; }
void SetEchoFunc(echoFunc f) { mEcho = f; }
void SetPrivFunc(privFunc f) { mPriv = f; }
2003-09-08 20:20:57 +00:00
};
#endif