Пример #1
0
bool FindAttrib( const char *xml, const char *name, CharBuf& val, const char *pend ){
    if( !xml || !name ) return false;
    const char *pc = strstr_nostr( xml, name );
    if( !pc || pc>=pend ) return false;
    // # Again, what are valid attribute name chars?
    if( pc>xml && (isalnum(pc[-1]) || pc[-1]=='_') ) return false;
    return GetAttrib( pc, name, val ) ? true : false;
}
Пример #2
0
const char *GetAttrib( const char *xml, const char *name, int &i ){
    CharBuf cb;
    xml = GetAttrib( xml, name, cb );
    if( !xml ) return NULL;
    if( cb[0]=='0' && tolower(cb[1])=='x' )
    	sscanf( cb, "%x", &i );
    else
    	sscanf( cb.Str(), "%d", &i );
    return xml;
}
Пример #3
0
BOOL ringFile::copyTo(LPCTSTR lpNewName,BOOL bForceOverWrite)
{
	if(lpNewName == NULL || *lpNewName == '\0')
		return FALSE;

	if(m_bExtern)
	{
		LPSTR lpbuf;
		int cnt = ReadAll(&lpbuf);
		if(cnt > 0)
		{
			ringFile rf = lpNewName;
			if(rf.isExist() && !bForceOverWrite)
				return FALSE;
			
			if(rf.Create(RF_NEW))
			{
				if(rf.Write(lpbuf,cnt))
					return TRUE;
				else
					return FALSE;
			}			
		}
		return FALSE;
	}

	char	dbuf[MAX_PATH];
	DWORD	attr = GetAttrib();

	if((attr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
	{
		if(lpNewName[strlen(lpNewName)-1] == '\\')
			wsprintf(dbuf,"%s%s\0\0",lpNewName,Filename());
		else
			wsprintf(dbuf,"%s\\%s\0\0",lpNewName,Filename());
	}
	else
		strcpy((char*)dbuf, (const char *)lpNewName);
	
	// 拷贝文件
	return ::CopyFile(m_szFilename,dbuf,!bForceOverWrite);
}
Пример #4
0
//如果文件已打开且以只读方式打开,失败
BOOL ringFile::SetFileTime(LPFILETIME lpCreate, LPFILETIME lpLast, LPFILETIME lpModify)
{
	BOOL bOpen = FALSE;

	if(!m_hFile)
	{
		if(MASK_MATCH(GetAttrib(),FILE_ATTRIBUTE_DIRECTORY))
			bOpen = Create(RF_EDIT,FILE_FLAG_BACKUP_SEMANTICS);
		else
			bOpen = Create(RF_EDIT);
	}

	// 设置时间	
	BOOL result = ::SetFileTime(m_hFile,lpCreate,lpLast,lpModify);

	if(bOpen)
		Close();

	return result;
}
Пример #5
0
BOOL ringFile::GetFileTime(LPFILETIME lpCreate, LPFILETIME lpLast, LPFILETIME lpModify)
{
	BOOL result;

	if(m_hFile)
		result = ::GetFileTime(m_hFile,lpCreate,lpLast,lpModify);
	else
	{
		if(MASK_MATCH(GetAttrib(),FILE_ATTRIBUTE_DIRECTORY))
			result = Open(RF_READ,RF_SHARE_READ,FILE_FLAG_BACKUP_SEMANTICS);
		else
			result = Open();

		if(result)
			result = ::GetFileTime(m_hFile,lpCreate,lpLast,lpModify);

		Close();
	}

	return result;
}
Пример #6
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{MAX_SWAP_INTERVAL}
	 */
	EGLint MaxSwapInterval(void) const
	{
		return GetAttrib(ConfigAttrib::MaxSwapInterval);
	}
Пример #7
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{CONFIG_ID}
	 */
	EGLint ConfigId(void) const
	{
		return GetAttrib(ConfigAttrib::ConfigId);
	}
Пример #8
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{CONFORMANT}
	 */
	Bitfield<eglplus::RenderableTypeBit> Conformant(void) const
	{
		return Bitfield<eglplus::RenderableTypeBit>(
			GetAttrib(ConfigAttrib::Conformant)
		);
	}
Пример #9
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{SURFACE_TYPE}
	 */
	Bitfield<eglplus::SurfaceTypeBit> SurfaceTypes(void) const
	{
		return Bitfield<eglplus::SurfaceTypeBit>(
			EGLenum(GetAttrib(ConfigAttrib::SurfaceType))
		);
	}
Пример #10
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{RENDERABLE_TYPE}
	 */
	Bitfield<eglplus::RenderableTypeBit> RenderableTypes(void) const
	{
		return Bitfield<eglplus::RenderableTypeBit>(
			EGLenum(GetAttrib(ConfigAttrib::RenderableType))
		);
	}
Пример #11
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{COLOR_BUFFER_TYPE}
	 */
	eglplus::ColorBufferType ColorBufferType(void) const
	{
		return eglplus::ColorBufferType(
			EGLenum(GetAttrib(ConfigAttrib::ColorBufferType))
		);
	}
Пример #12
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{LUMINANCE_SIZE}
	 */
	EGLint LuminanceSize(void) const
	{
		return GetAttrib(ConfigAttrib::LuminanceSize);
	}
Пример #13
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{BLUE_SIZE}
	 */
	EGLint BlueSize(void) const
	{
		return GetAttrib(ConfigAttrib::BlueSize);
	}
Пример #14
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{GREEN_SIZE}
	 */
	EGLint GreenSize(void) const
	{
		return GetAttrib(ConfigAttrib::GreenSize);
	}
Пример #15
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{RED_SIZE}
	 */
	EGLint RedSize(void) const
	{
		return GetAttrib(ConfigAttrib::RedSize);
	}
Пример #16
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{NATIVE_RENDERABLE}
	 */
	EGLint NativeRenderable(void) const
	{
		return GetAttrib(ConfigAttrib::NativeRenderable);
	}
Пример #17
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{CONFIG_CAVEAT}
	 */
	eglplus::ConfigCaveat ConfigCaveat(void) const
	{
		return eglplus::ConfigCaveat(
			EGLenum(GetAttrib(ConfigAttrib::ConfigCaveat))
		);
	}
Пример #18
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{ALPHA_SIZE}
	 */
	EGLint AlphaSize(void) const
	{
		return GetAttrib(ConfigAttrib::AlphaSize);
	}
Пример #19
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{TRANSPARENT_TYPE}
	 */
	eglplus::TransparentType TransparentType(void) const
	{
		return eglplus::TransparentType(
			EGLenum(GetAttrib(ConfigAttrib::TransparentType))
		);
	}
Пример #20
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{DEPTH_SIZE}
	 */
	EGLint DepthSize(void) const
	{
		return GetAttrib(ConfigAttrib::DepthSize);
	}
Пример #21
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{RENDERABLE_TYPE}
	 */
	bool HasRenderableType(eglplus::RenderableTypeBit type) const
	{
		EGLenum a = GetAttrib(ConfigAttrib::RenderableType);
		EGLenum b = EGLenum(type);
		return (a & b) == b;
	}
Пример #22
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{STENCIL_SIZE}
	 */
	EGLint StencilSize(void) const
	{
		return GetAttrib(ConfigAttrib::StencilSize);
	}
Пример #23
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{SURFACE_TYPE}
	 */
	bool HasSurfaceType(eglplus::SurfaceTypeBit type) const
	{
		EGLenum a = GetAttrib(ConfigAttrib::SurfaceType);
		EGLenum b = EGLenum(type);
		return (a & b) == b;
	}
Пример #24
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{MAX_PBUFFER_WIDTH}
	 */
	EGLint MaxPbufferWidth(void) const
	{
		return GetAttrib(ConfigAttrib::MaxPbufferWidth);
	}
Пример #25
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{CONFORMANT}
	 */
	bool IsConformantTo(eglplus::RenderableTypeBit type) const
	{
		EGLenum a = GetAttrib(ConfigAttrib::Conformant);
		EGLenum b = EGLenum(type);
		return (a & b) == b;
	}
Пример #26
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{MAX_PBUFFER_HEIGHT}
	 */
	EGLint MaxPbufferHeight(void) const
	{
		return GetAttrib(ConfigAttrib::MaxPbufferHeight);
	}
Пример #27
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{BUFFER_SIZE}
	 */
	EGLint BufferSize(void) const
	{
		return GetAttrib(ConfigAttrib::BufferSize);
	}
Пример #28
0
	/**
	 *  @eglsymbols
	 *  @eglfunref{GetConfigAttrib}
	 *  @egldefref{MAX_PBUFFER_PIXELS}
	 */
	EGLint MaxPbufferPixels(void) const
	{
		return GetAttrib(ConfigAttrib::MaxPbufferPixels);
	}