资源简介
c++ CMarkup解析xml 感觉还不错 分享CMarkup类

代码片段和文件信息
// Markup.cpp: implementation of the CMarkup class.
//
// Markup Release 11.5
// Copyright (C) 2011 First objective Software Inc. All rights reserved
// Go to www.firstobject.com for the latest CMarkup and EDOM documentation
// Use in commercial applications requires written permission
// This software is provided “as is“ with no warranty.
//
#include
#include “Markup.h“
#if defined(MCD_STRERROR) // C error routine
#include
#endif // C error routine
#if defined (MARKUP_ICONV)
#include
#endif
#define x_ATTRIBQUOTE ‘\“‘ // can be double or single quote
#if defined(MARKUP_STL) && ( defined(MARKUP_WINCONV) || (! defined(MCD_STRERROR)))
#include // for MultiByteToWideChar WideCharToMultiByte FormatMessage
#endif // need windows.h when STL and (not setlocale or not strerror) MFC afx.h includes it already
#if defined(MARKUP_MBCS) // MBCS/double byte
#pragma message( “Note: MBCS build (not UTF-8)“ )
// For UTF-8 remove MBCS from project settings C/C++ preprocessor definitions
#if defined (MARKUP_WINCONV)
#include // for VC++ _mbclen
#endif // WINCONV
#endif // MBCS/double byte
#if defined(_DEBUG) && _MSC_VER > 1000 // VC++ DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#if defined(DEBUG_NEW)
#define new DEBUG_NEW
#endif // DEBUG_NEW
#endif // VC++ DEBUG
// Disable “while ( 1 )“ warning in VC++ 2002
#if _MSC_VER >= 1300 // VC++ 2002 (7.0)
#pragma warning(disable:4127)
#endif // VC++ 2002 (7.0)
//////////////////////////////////////////////////////////////////////
// Internal static utility functions
//
void x_StrInsertReplace( MCD_STR& str int nLeft int nReplace const MCD_STR& strInsert )
{
// Insert strInsert into str at nLeft replacing nReplace chars
// Reduce reallocs on growing string by reserving string space
// If realloc needed allow for 1.5 times the new length
//
int nStrLength = MCD_STRLENGTH(str);
int nInsLength = MCD_STRLENGTH(strInsert);
int nNewLength = nInsLength + nStrLength - nReplace;
int nAllocLen = MCD_STRCAPACITY(str);
#if defined(MCD_STRINSERTREPLACE) // STL replace method
if ( nNewLength > nAllocLen )
MCD_BLDRESERVE( str (nNewLength + nNewLength/2 + 128) );
MCD_STRINSERTREPLACE( str nLeft nReplace strInsert );
#else // MFC no replace method
int nBufferLen = nNewLength;
if ( nNewLength > nAllocLen )
nBufferLen += nBufferLen/2 + 128;
MCD_CHAR* pDoc = MCD_GETBUFFER( str nBufferLen );
if ( nInsLength != nReplace && nLeft+nReplace < nStrLength )
memmove( &pDoc[nLeft+nInsLength] &pDoc[nLeft+nReplace] (nStrLength-nLeft-nReplace)*sizeof(MCD_CHAR) );
if ( nInsLength )
memcpy( &pDoc[nLeft] strInsert nInsLength*sizeof(MCD_CHAR) );
MCD_RELEASEBUFFER( str pDoc nNewLength );
#endif // MFC no replace method
}
int x_Hash( MCD_PCSZ p int nSize )
{
unsigned int n=0;
while (*p)
n += (unsigned int)(*p++);
return n % nSize;
}
MCD_STR x_IntTo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 176798 2011-04-17 21:06 CMark类\Markup.cpp
文件 20033 2011-04-17 21:06 CMark类\Markup.h
目录 0 2013-10-24 16:37 CMark类
----------- --------- ---------- ----- ----
196831 3
- 上一篇:C++ 操作注册表
- 下一篇:AGC的算法DSP上的
相关资源
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
- VC++基于OpenGL模拟的一个3维空间模型
评论
共有 条评论