filesections.h

来自「The library provides supports for run-ti」· C头文件 代码 · 共 40 行

H
40
字号

#ifndef FILESECTIONS_H
#define FILESECTIONS_H

#include "utils/ExpArr.hpp"
#include "utils/StringBuffer.h"

// Read a text file, looking for sections:
// ##%% ASectionName %%##
// text to read here
// ##%% end %%##


class FileSections {
public:
	FileSections( const char *path=NULL );
	~FileSections( );
	
	bool AddFile( const char *path );
	bool SubstSection( const char *name, const StrBuf &sb_fr, StrBuf &out );
	StrBuf& GetSection( const char *name, bool &b_ok ){
		int ix = m_names.FindIndexOf(name);
		if( ix<0 ){
			static StrBuf sb_dummy;
			b_ok = false;
			return sb_dummy;
		}
		b_ok = true;
		return *m_sections[ix];
	}

protected:	
	StrBuf m_names;
	ExpArrP<StrBuf*> m_sections;
};

#endif // FILESECTIONS_H


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?