当前位置: 首页>>代码示例>>C++>>正文


C++ ReadText函数代码示例

本文整理汇总了C++中ReadText函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadText函数的具体用法?C++ ReadText怎么用?C++ ReadText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ReadText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ftell

void vtkDCMParser::ReadElement(DCMDataElementStruct *des)
{
  if(this->file_in)
    {
      PrevFilePos = ftell(file_in);
      PrevFileIOMessage = FileIOMessage;

      switch(TransferSyntax)
      {
      case TFS_IVRLE:
      case TFS_IVRBE:
        
        des->GroupCode = ReadUINT16();
        des->ElementCode = ReadUINT16();
        des->Length = ReadUINT32();

        des->NextBlock = ftell(file_in);
        if(des->Length != 0xffffffff)
          des->NextBlock += des->Length;

        sprintf(des->VR, "??");
        
        break;
        
      case TFS_EVRLE:
      case TFS_EVRBE:
        
        des->GroupCode = ReadUINT16();
        des->ElementCode = ReadUINT16();
        
        if((des->GroupCode) == 0xfffe)
          {
            if((des->ElementCode == 0xe000) ||
             (des->ElementCode == 0xe00d) ||
             (des->ElementCode == 0xe0dd))
            { // must be implicit VR always
              des->Length = ReadUINT32();

              des->NextBlock = ftell(file_in);
              if(des->Length != 0xffffffff)
                des->NextBlock += des->Length;

              sprintf(des->VR, "??");

              return;
            }
          }
        
        ReadText(des->VR, 2); // getting VR
        
        if((strcmp(des->VR, "OB") == 0) ||
           (strcmp(des->VR, "OW") == 0) ||
           (strcmp(des->VR, "SQ") == 0) ||
           (strcmp(des->VR, "UN") == 0) ||
           (strcmp(des->VR, "UT") == 0)
           )
          {
            des->Length = ReadUINT16(); // reserved field
            des->Length = ReadUINT32();
            des->NextBlock = ftell(file_in);
            if(des->Length != 0xffffffff)
              des->NextBlock += des->Length;
          } else
          {
            des->Length = ReadUINT16();
            des->NextBlock = ftell(file_in);
            if(des->Length != 0xffffffff)
              des->NextBlock += des->Length;
          }
        
        break;
      }
    }
}
开发者ID:fedral,项目名称:paper,代码行数:74,代码来源:vtkDCMParser.cpp

示例2: HandleClean

				void PowerPointSlidePersistTextBytesState::Handle(PptReaderImpl* pPowerPointImpl, EshObject& eshObject) const
				{
					if (pPowerPointImpl->GetReader()->IsFlagCleanHiddenSlides())
					{
						HandleClean(pPowerPointImpl, eshObject);
						return;
					}
					try
					{
						EshAtom* pAtom = ChDOWNCAST<EshObject, EshAtom>(&eshObject);
						if(0 == pAtom)
							throw std::logic_error("Invalid PowerPoint Binary Document EshAtom, the object does not contain a valid EshAtom object");

						pPowerPointImpl->GetReader()->read(*pAtom);

						std::wcstring text = ReadText(pAtom);
						if (!text.empty())
						{
							SlideInfo* pSlideInfo = pPowerPointImpl->GetSlideByReferenceId(pPowerPointImpl->GetCurrentSlideReference());
							if(0 == pSlideInfo)
								pSlideInfo = pPowerPointImpl->AddSlide(pPowerPointImpl->GetCurrentSlideReference(), text);

							pSlideInfo->SetCurrentTextNumber(pSlideInfo->GetCurrentTextNumber() + 1);
							DocumentText::ptr_type docText = pPowerPointImpl->GetVisitor();
							
							//pPowerPointImpl->GetReader()->read(*pTextHeaderAtom);
							if (pPowerPointImpl->GetCurrentTextIsTitle())
							{
								pSlideInfo->SetTitle(text);
														
							}

							std::wcstring prefix = _LL("TEXTBOX");
							prefix += ReaderHelpers::MakeNumberString((pSlideInfo->GetCurrentTextNumber()));
							AbstractTextNode::id_type id = ReaderHelpers::CreateIdForPowerPointNode(prefix, pSlideInfo->GetSlideNumber());
							AbstractTextNode::ptr_type textNode = docText->GetTextNode(id);
							if(textNode == 0)
							{
								textNode = new TextNode(id);
							}
							textNode->AddAdditionalInfo(docText, _LL("SlideId"), ReaderHelpers::MakeNumberString((pSlideInfo->GetSlideNumber())), AbstractTextNode::Long);
							textNode->AddAdditionalInfo(docText, _LL("Title"), pSlideInfo->GetTitle(), AbstractTextNode::String);
							textNode->AddAdditionalInfo(docText, _LL("Content"), text, AbstractTextNode::String);
							docText->AddTextNode(AbstractTextType::TextBox, textNode);

							pSlideInfo->AddContent(text);
							ChWriter* pInfo = pAtom->DetachOverwriteInfo();
							if (pInfo)
								pSlideInfo->AddOverwriteInfo(pInfo);
						}

						if(PptTextHeaderAtom::ID == eshObject.getType())
						{
							pPowerPointImpl->ChangeState<PowerPointSlidePersistTextHeaderState>();
							pPowerPointImpl->GetCurrentState()->Handle(pPowerPointImpl, eshObject);
							return;
						}

						if(PptSlidePersistAtom::ID == eshObject.getType())
						{
							pPowerPointImpl->ChangeState<PowerPointSlidePersistState>();
							// Handle the current state to retrieve the slide reference id.
							pPowerPointImpl->GetCurrentState()->Handle(pPowerPointImpl, eshObject);
						}

						pPowerPointImpl->ChangeState<PowerPointAtomState>();
					}
					catch (CsException& ex)
					{
						throw std::logic_error(ReaderHelpers::ConstructErrorText(ex));
					}
				}
开发者ID:killbug2004,项目名称:WSProf,代码行数:72,代码来源:PowerPointSlidePersistTextBytesState.cpp

示例3: _T

int KTgaBlockLoader::LoadUITex(LPCTSTR pcszUITex, int nLoadStyle, 
							   int nReadKind, int nFindKind, int TgaInd, 
                               int nFrameNum, HWND hWnd)
{
	int nResult = false;
	int nRetCode = false; 

	size_t uReadIn;
	FILE *fpUiTex = NULL;
	UITEXFILEHEADER UiTexFileHeader;

	LPTSTR pszClip = NULL;
	LPTSTR pszTemp = NULL;
	LPTSTR pszText = NULL;

	TCHAR szTgaName[MAX_PATH];
	TCHAR szSTexName[MAX_PATH];
	TCHAR szTextName[MAX_PATH];

	szTgaName[0] = _T('\0');
	szSTexName[0] = _T('\0');
	szTextName[0] = _T('\0');

	KG_PROCESS_ERROR(pcszUITex);

	fpUiTex = fopen(pcszUITex, "rb");
	KG_PROCESS_ERROR(fpUiTex);

	uReadIn = fread(&UiTexFileHeader, sizeof(UiTexFileHeader), 1, fpUiTex);
	KG_PROCESS_ERROR(uReadIn == 1);
	fclose(fpUiTex);
	fpUiTex = NULL;
	_tcsncpy(szTgaName, pcszUITex, sizeof(szTgaName) / sizeof(TCHAR));
	szTgaName[sizeof(szTgaName) / sizeof(TCHAR) - 1] = _T('\0');
	pszClip = _tcsrchr(szTgaName, '\\');
	if (pszClip)
		++pszClip;
	else
		pszClip = szTgaName;
	pszTemp = _tcsrchr(pszClip, '/');
	if (pszTemp)
		pszClip = pszTemp + 1;
	_tcsncpy(pszClip, UiTexFileHeader.szTgaFileName, sizeof(szTgaName) / sizeof(TCHAR)- (pszClip - szTgaName));
	szTgaName[sizeof(szTgaName) / sizeof(TCHAR) - 1] = _T('\0');

	_tcsncpy(szTextName,pcszUITex,sizeof(szTextName)/sizeof(TCHAR));
	pszText = _tcsrchr(szTextName, _T('.'));
	*pszText = _T('\0');
	_tcsncat(pszText, ".txt", sizeof(pszText) / sizeof(TCHAR));

	if (nLoadStyle == LOAD_AS_REPLACE)
	{
		nRetCode = KSaveManager::GetSelf().SetCurrentEditFile(pcszUITex, szTgaName, szSTexName, szTextName);
		KG_PROCESS_ERROR(nRetCode);        
	}

	nRetCode = SetUITexName(pcszUITex);
	KG_PROCESS_ERROR(nRetCode);
	nRetCode = SetTgaName(szTgaName);
	KG_PROCESS_ERROR(nRetCode);
	nRetCode = SetSTexName(szSTexName);
	KG_PROCESS_ERROR(nRetCode);
	nRetCode = SetTextName(szTextName);
	KG_PROCESS_ERROR(nRetCode);

//	if (nReadKind)
//	{
		nRetCode = ReadText(szTextName, nLoadStyle);
		KG_PROCESS_ERROR(nRetCode);
//	}
	nRetCode = ReadUITex(pcszUITex, nLoadStyle, nFindKind, TgaInd, nFrameNum);
	KG_PROCESS_ERROR(nRetCode);

	nResult = true;
Exit0:
	if (fpUiTex)
	{
		fclose(fpUiTex);
		fpUiTex = NULL;
	}
	return nResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:82,代码来源:KTgaBlockLoader.cpp

示例4: Clear

BOOL C4Playback::Open(C4Group &rGrp) {
  // clean up
  Clear();
  fLoadSequential = false;
  iLastSequentialFrame = 0;
  bool fStrip = false;
  // get text record file
  StdStrBuf TextBuf;
  if (rGrp.LoadEntryString(C4CFN_CtrlRecText, TextBuf)) {
    if (!ReadText(TextBuf)) return FALSE;
  } else {
    // open group? Then do some sequential reading for large files
    // Can't do this when a dump is forced, because the dump needs all data
    // Also can't do this when stripping is desired
    if (!rGrp.IsPacked())
      if (!Game.RecordDumpFile.getLength())
        if (!fStrip) fLoadSequential = true;
    // get record file
    if (fLoadSequential) {
      if (!rGrp.FindEntry(C4CFN_CtrlRec)) return FALSE;
      if (!playbackFile.Open(
              FormatString("%s%c%s", rGrp.GetFullName().getData(),
                           (char)DirectorySeparator,
                           (const char *)C4CFN_CtrlRec).getData()))
        return FALSE;
      // forcing first chunk to be read; will call ReadBinary
      currChunk = chunks.end();
      if (!NextSequentialChunk()) {
        // empty replay??!
        LogFatal("Record: Binary read error.");
        return FALSE;
      }
    } else {
      // non-sequential reading: Just read as a whole
      StdBuf BinaryBuf;
      if (rGrp.LoadEntry(C4CFN_CtrlRec, BinaryBuf)) {
        if (!ReadBinary(BinaryBuf)) return FALSE;
      } else {
        // file too large? Try sequential loading and parsing
        /*				size_t iSize;
                                        if (rGrp.AccessEntry(C4CFN_CtrlRec,
           &iSize))
                                                {
                                                CStdFile fOut;
           fOut.Create(Game.RecordDumpFile.getData());
                                                fLoadSequential = true;
                                                const size_t iChunkSize =
           1024*1024*16; // 16M
                                                while (iSize)
                                                        {
                                                        size_t iLoadSize =
           Min<size_t>(iChunkSize, iSize);
                                                        BinaryBuf.SetSize(iLoadSize);
                                                        if
           (!rGrp.Read(BinaryBuf.getMData(), iLoadSize))
                                                                {
                                                                LogFatal("Record:
           Binary load error!");
                                                                return FALSE;
                                                                }
                                                        iSize -= iLoadSize;
                                                        if
           (!ReadBinary(BinaryBuf)) return FALSE;
                                                        LogF("%d binary
           remaining", iSize);
                                                        currChunk =
           chunks.begin();
                                                        if (fStrip) Strip();
                                                        StdStrBuf
           s(ReWriteText());
                                                        fOut.WriteString(s.getData());
                                                        LogF("Wrote %d text
           bytes (%d binary remaining)", s.getLength(), iSize);
                                                        chunks.clear();
                                                        }
                                                fOut.Close();
                                                fLoadSequential = false;
                                                }
                                        else*/
        {
          // no control data?
          LogFatal("Record: No control data found!");
          return FALSE;
        }
      }
    }
  }
  // rewrite record
  if (fStrip) Strip();
  if (Game.RecordDumpFile.getLength()) {
    if (SEqualNoCase(GetExtension(Game.RecordDumpFile.getData()), "txt"))
      ReWriteText().SaveToFile(Game.RecordDumpFile.getData());
    else
      ReWriteBinary().SaveToFile(Game.RecordDumpFile.getData());
  }
  // reset status
  currChunk = chunks.begin();
  Finished = false;
// external debugrec file
#if defined(DEBUGREC_EXTFILE) && defined(DEBUGREC)
//.........这里部分代码省略.........
开发者ID:ev1313,项目名称:clonk-rage,代码行数:101,代码来源:C4Record.cpp

示例5: RequestProc

static unsigned _stdcall RequestProc( void *arg )
{
	int *pBuffer;
	DWORD dwRet;
	HANDLE heventWait[2];
	int iBeginLine, iEndLine;

	heventWait[0] = heventParentSend;
	heventWait[1] = heventDone;

	for(;; )
	{
		dwRet = WaitForMultipleObjects( 2, heventWait, FALSE, INFINITE );

		// heventDone fired, so we're exiting.
		if( dwRet == WAIT_OBJECT_0 + 1 )
			break;

		pBuffer = (int *) GetMappedBuffer( hfileBuffer );

		// hfileBuffer is invalid.  Just leave.
		if( !pBuffer )
		{
			printf( "Invalid hfileBuffer\n" );
			break;
		}

		switch( pBuffer[0] )
		{
		case CCOM_WRITE_TEXT:
			// Param1 : Text
			pBuffer[0] = WriteText( (LPCTSTR) ( pBuffer + 1 ) );
			break;

		case CCOM_GET_TEXT:
			// Param1 : Begin line
			// Param2 : End line
			iBeginLine = pBuffer[1];
			iEndLine = pBuffer[2];
			pBuffer[0] = ReadText( (LPTSTR) ( pBuffer + 1 ), iBeginLine,
			                      iEndLine );
			break;

		case CCOM_GET_SCR_LINES:
			// No params
			pBuffer[0] = GetScreenBufferLines( &pBuffer[1] );
			break;

		case CCOM_SET_SCR_LINES:
			// Param1 : Number of lines
			pBuffer[0] = SetScreenBufferLines( pBuffer[1] );
			break;
		}

		ReleaseMappedBuffer( pBuffer );
		SetEvent( heventChildSend );
	}

	_endthreadex( 0 );
	arg = NULL; // wsw : aiwa : shut up compiler
	return 0;
}
开发者ID:Racenet,项目名称:racesow,代码行数:62,代码来源:conproc.c

示例6: ReadText

float XmlParser::ReadFloat(char* nodePath)
{
	char output[256];
	ReadText(nodePath, output, sizeof(output));
	return static_cast<float>(atof(output));
}
开发者ID:rkolev,项目名称:diplomna-igra,代码行数:6,代码来源:XmlParser.cpp

示例7: GetLength

ByteBufferPtr File::ReadText()
{
	uint32_t length = GetLength();
	return ReadText(length);
}
开发者ID:serengeor,项目名称:TheEngine,代码行数:5,代码来源:File.cpp

示例8: pagesRead

void appCopyPaste::PastePages()
{
    bool fileReadOK = false;
    MenuPageArray pagesRead(16);
    int nObjects;
    try
        {
            appConfigFile::OpenAsClipboard(true);

            //  header
            ReadPageHeader();

            int nPages   = ReadInt();
            int ntotalPages = ReadInt();
            nObjects = ReadInt();

            if (nPages == 0)
                InputError("No pages ??");

            // check that all page types are supported
            char tempStr[160];
            for (int i = 0; i < ntotalPages; i++)
                {
                    ReadText(tempStr, 160);
                    if (!AllocPageC::MenuPageExists(tempStr))
                        InputError("Page type not supported by application");
                }

            // and all object types
            for (int i = 0; i < nObjects; i++)
                {
                    ReadText(tempStr, 160);
                    if (!AllocObjC::MenuObjectExists(tempStr))
                        InputError("Object type not supported by application");
                }

            AppMenuC::GetApp().PrePasteSetup();

            // read app globals
            ReadAppGlobals();

            // read pages
            pagesRead.Alloc(nPages);

            for (int i = 0; i < nPages; i++)
                {
                    ReadText(tempStr, 160);

                    //  convert to page type
                    if (!AllocPageC::MenuPageExists(tempStr))
                        InputError("Page type conversion error ??");

                    //  create new page
                    MenuPageC* newPage = AllocPageC::CreateMenuPage(tempStr);

                    bool childOK = (MenuPageC::currPageObj == 0) ||
                        MenuPageC::currPageObj->AcceptAsChild(*newPage);

                    // test to see if it can be added as child of current page
                    if (childOK && newPage->AcceptAsParent(MenuPageC::currPageObj))
                        {
                            // parent OK -- finish up
                            newPage->ParentChanging(MenuPageC::currPageObj);
                            if (MenuPageC::currPageObj != 0)
                                {
                                    MenuPageC::currPageObj->childPages += newPage;
                                    MenuPageC::currPageObj->ResetChildren();
                                }
                        }
                    else if (!newPage->AcceptAsParent(NULL))
                        {
                            delete newPage;
                            InputError("Page type cannot be pasted");
                        }

                    // add it to list
                    pagesRead.AddTo(newPage);

                    // read it
                    newPage->ReadFromFile();
                }

            AppMenuC::GetApp().PostPasteFixup();

            fileReadOK = true;
        }
    catch (TextC::TextError re) {
        GenAppErrorMsg("PastePages", re.errMsg);
    }

    appConfigFile::Close();

    if (!pagesRead.IsEmpty())
        {
            UpdateAppObjects();

            // update all pointers
            for (int i = 0; i < pagesRead.Size(); i++)
                UpdatePagePointers(pagesRead.GetRef(i));

//.........这里部分代码省略.........
开发者ID:jjayne,项目名称:nSIGHTS,代码行数:101,代码来源:AppCopyPaste.cpp

示例9: ReadObjHeader

void appCopyPaste::PasteObjects()
{
    bool fileReadOK = false;
    MenuObjArray objectsRead;
    try
        {
            appConfigFile::OpenAsClipboard(true);

            //  header
            ReadObjHeader();

            int nObjects = ReadInt();
            if (nObjects == 0)
                InputError("No objects ??");

            // check that page type is supported
            char pageStr[160];
            ReadText(pageStr, 160);
            if (!AllocPageC::MenuPageExists(pageStr))
                InputError("Page type not supported by application");

            // and all object types
            for (int i = 0; i < nObjects; i++)
                {
                    char objStr[160];
                    ReadText(objStr, 160);
                    if (!AllocObjC::MenuObjectExists(objStr))
                        InputError("Object type not supported by application");
                    if (!MenuPageC::currPageObj->ObjectOKForPage(objStr))
                        InputError("Object not supported on current page");
                }

            // read app globals
            ReadAppGlobals();
            AppMenuC::GetApp().PrePasteSetup();


            //  read objects
            objectsRead.Alloc(nObjects);
            for (int i = 0; i < nObjects; i++)
                {
                    char objStr[160];
                    ReadText(objStr, 160);
                    MenuObjC* currObj = AllocObjC::CreateMenuObject(objStr, MenuPageC::currPageObj->GetActualParent());
                    currObj->ReadFromFile();

                    objectsRead += currObj;
                    MenuPageC::currPageObj->AddObject(currObj);
                    MenuRootC::currTreeObj->AddObjectLeafToRoot(MenuPageC::currPageObj, currObj);
                }

            AppMenuC::GetApp().PrePasteSetup();

            fileReadOK = true;
        }
    catch (TextC::TextError re) {
        GenAppErrorMsg("PasteObjects", re.errMsg);
    }

    appConfigFile::Close();

    if (!objectsRead.IsEmpty())
        {

            UpdateAppObjects();


            MenuObjC* currObj;

            // update all pointers
            int i;
            for (i = 0; i < objectsRead.Size(); i++)
                {
                    currObj = objectsRead[i];

                    // update refs
                    currObj->objFunction->UpdateFuncObjRefs();
                    currObj->objDeleteable = true;
                    currObj->objSelected = false;
                }

            // set all FO status and UI
            for (i = 0; i < objectsRead.Size(); i++)
                {

                    currObj = objectsRead[i];
                    currObj->objFunction->DoStatusChk();
                    currObj->UpdateTreeData();
                }

            if (fileReadOK)
                {
                    GenAppClearMsgs();

                    FuncObjArray objsToCalc(objectsRead.Size());
                    objsToCalc.SetEmpty();
                    for (i = 0; i < objectsRead.Size(); i++)
                        objsToCalc += objectsRead[i]->objFunction;

                    FuncObjC::CalcSelectedObjects(foc_Full, objsToCalc);
//.........这里部分代码省略.........
开发者ID:jjayne,项目名称:nSIGHTS,代码行数:101,代码来源:AppCopyPaste.cpp

示例10: ReadMsgFile

/*-------------------------------------------------------------------------*/
APIRET ReadMsgFile( CHAR *netfile )
{
    APIRET           rc;
    CHAR            *string;
    INDEXPKT        *top;

    if(( rc = OpenFile( netfile )) != 0 )
        return( rc );
    
    if( fread( &msg, sizeof( msg ), 1, PktFile ) != 1 )
    {
        CloseFile();
        ShowError( "Error read file '%s'", ShowPath( netfile, 50 ));
        return( ERROR_READ_FAULT );
    }

    filename = netfile;

    string = malloc( MAX_BUFFER );

    if( string == NULL )
        return( ERROR_NOT_ENOUGH_MEMORY );

    pktcount = 1;

    AddNextStruct( pktIndex, top );

    if( top == NULL )
    {
        free( string );
        return( ERROR_NOT_ENOUGH_MEMORY );
    }

    Current = top;

    top -> AddrFrom.Zone      = 0;
    top -> AddrFrom.Net       = msg.orig_net;
    top -> AddrFrom.Node      = msg.orig_node;
    top -> AddrFrom.Point     = 0;
    top -> AddrFrom.Domain[0] = 0;

    top -> AddrTo.Zone        = 0;
    top -> AddrTo.Net         = msg.dest_net;
    top -> AddrTo.Node        = msg.dest_node;
    top -> AddrTo.Point       = 0;
    top -> AddrTo.Domain[0]   = 0;

    top -> attr               = msg.attrib;

    strcpy( string, msg.to   ); string[ MAX_TO ]   = 0; top -> to   = strdup( string );
    strcpy( string, msg.from ); string[ MAX_FROM ] = 0; top -> from = strdup( string );
    strcpy( string, msg.subj ); string[ MAX_SUBJ ] = 0; top -> subj = strdup( string );
    strcpy( string, msg.date ); string[ MAX_DATE ] = 0; top -> date = strdup( string );

    free( string );

    top -> area    = NULL;
    top -> sel     = ' ';
    top -> change  = 0;
    top -> size    = filelength( fileno( PktFile ));
    top -> name    = strdup( netfile );
    
    CloseFile();

    rc = ReadText( 1 );

    return( rc  );
}
开发者ID:OS2World,项目名称:APP-COMM-PKT_MSG_Viewer_2,代码行数:69,代码来源:read.c

示例11: OnValReadStart

CFSVar CJSONReader::ReadVal(const CFSAString &szKeyPath)
{
	OnValReadStart(szKeyPath);
	CFSVar Data;

	if (m_cCh=='[') {
		Data.Cast(CFSVar::VAR_ARRAY);
		GetChar(true);
		INTPTR ipPos=0;
		for (;;) {
			if (m_cCh==0) {
				throw CJSONException(FSTSTR("Unexpetcted EOF"));
			} else if (m_cCh==']') {
				GetChar(true);
				break;
			} else if (ipPos>0) {
				if (m_cCh==',') {
					GetChar(true);
				} else {
					throw CJSONException(FSTSTR("Missing ',' in array"));
				}
			}

			CFSAString szKey;
			szKey.Format("%zd", ipPos);
			CFSVar Data1=ReadVal(szKeyPath+"/"+szKey);
			if (m_iCollectData>0) {
				Data[ipPos]=Data1;
			}
			ipPos++;
		}
	} else if (m_cCh=='{') {
		Data.Cast(CFSVar::VAR_MAP);
		GetChar(true);
		INTPTR ipPos=0;
		for (;;) {
			if (m_cCh==0) {
				throw CJSONException(FSTSTR("Unexpetcted EOF"));
			} else if (m_cCh=='}') {
				GetChar(true);
				break;
			} else if (ipPos>0) {
				if (m_cCh==',') {
					GetChar(true);
				} else {
					throw CJSONException(FSTSTR("Missing ',' in map"));
				}
			}

			CFSAString szKey;
			if (m_cCh=='\"' || m_cCh=='\'') {
				szKey=ReadString();
			} else if (FSIsLetter(m_cCh)) {
				szKey=ReadText();
			} else {
				throw CJSONException(FSTSTR("Expected key"));
			}
			if (m_cCh==':') {
				GetChar(true);
			} else {
				throw CJSONException(FSTSTR("Expected ':'"));
			}
			CFSVar Data1=ReadVal(szKeyPath+"/"+szKey);
			if (m_iCollectData>0) {
				Data[szKey]=Data1;
			}
			ipPos++;
		}
	} else if (m_cCh=='\"' || m_cCh=='\'') {
		Data=ReadString();
	} else if ((m_cCh>='0' && m_cCh<='9') || FSStrChr("-+.", m_cCh)) {
		Data=ReadNumber();
	} else if (FSIsLetter(m_cCh)) {
		Data=ReadConst();
	} else if (!m_cCh) {
	} else {
		throw CJSONException(FSTSTR("Unknown value type"));
	}

	OnValReadEnd(szKeyPath, Data);
	return Data;
}
开发者ID:urdvr,项目名称:vabamorf,代码行数:82,代码来源:json.cpp

示例12: gzopen_w

// 显示文件中的设置
void CSettingDlg::ShowOptionsInFile(LPCTSTR path)
{
	CString strBuf;

	gzFile f = gzopen_w(path, "rb");
	if (f == NULL)
		goto UseDefaultOptions;

	// 头部
	char header[2];
	gzread(f, header, sizeof(header));
	if (header[0] != 'T' || header[1] != 'B')
	{
		gzclose(f);
		goto UseDefaultOptions;
	}

	// 违规内容
	ReadRegexTexts(f, m_keywordsPage.m_list);

	// 屏蔽用户
	ReadRegexTexts(f, m_blackListPage.m_list);

	// 信任用户
	int size;
	gzread(f, &size, sizeof(int)); // 长度
	m_whiteListPage.m_list.ResetContent();
	int intBuf;
	for (int i = 0; i < size; i++)
	{
		ReadText(f, strBuf);
		m_whiteListPage.m_list.AddString(strBuf);
	}

	// 信任内容
	ReadRegexTexts(f, m_whiteContentPage.m_list);

	// 违规图片
	m_imagePage.m_updateImage = TRUE;

	BOOL boolBuf;
	float floatBuf;
	double doubleBuf;
	gzread(f, &intBuf, sizeof(int));						// 扫描间隔
	strBuf.Format(_T("%d"), intBuf);
	m_prefPage.m_scanIntervalEdit.SetWindowText(strBuf);
	gzread(f, &boolBuf, sizeof(BOOL));						// 封ID
	m_prefPage.m_banIDCheck.SetCheck(boolBuf);
	gzread(f, &intBuf, sizeof(int));						// 封禁时长
	m_prefPage.m_banDurationCombo.SetCurSel(intBuf == 1 ? 0 : (intBuf == 3 ? 1 : 2));
	gzread(f, &boolBuf, sizeof(BOOL));						// 封IP
	gzread(f, &intBuf, sizeof(int));						// 封禁违规次数
	strBuf.Format(_T("%d"), intBuf);
	m_prefPage.m_trigCountEdit.SetWindowText(strBuf);
	gzread(f, &boolBuf, sizeof(BOOL));						// 只扫描标题
	m_prefPage.m_onlyScanTitleCheck.SetCheck(boolBuf);
	gzread(f, &floatBuf, sizeof(float));					// 删帖间隔
	strBuf.Format(_T("%g"), floatBuf);
	m_prefPage.m_deleteIntervalEdit.SetWindowText(strBuf);
	gzread(f, &boolBuf, sizeof(BOOL));						// 操作前提示
	m_prefPage.m_confirmCheck.SetCheck(boolBuf);
	gzread(f, &intBuf, sizeof(int));						// 扫描最后页数
	strBuf.Format(_T("%d"), intBuf);
	m_prefPage.m_scanPageCountEdit.SetWindowText(strBuf);
	gzread(f, &boolBuf, sizeof(BOOL));						// 只输出删帖封号
	m_prefPage.m_briefLogCheck.SetCheck(boolBuf);
	if (gzread(f, &boolBuf, sizeof(BOOL)) == sizeof(BOOL))	// 删帖
		m_prefPage.m_deleteCheck.SetCheck(boolBuf);
	else
		m_prefPage.m_deleteCheck.SetCheck(TRUE);
	if (gzread(f, &intBuf, sizeof(int)) == sizeof(int))		// 线程数
	{
		strBuf.Format(_T("%d"), intBuf);
		m_prefPage.m_threadCountEdit.SetWindowText(strBuf);
	}
	else
		m_prefPage.m_threadCountEdit.SetWindowText(_T("2"));
	ReadText(f, strBuf);									// 封禁原因
	m_prefPage.m_banReasonEdit.SetWindowText(strBuf);
	ReadText(f, strBuf);									// 违规图片目录
	m_imagePage.m_dirEdit.SetWindowText(strBuf);
	if (gzread(f, &doubleBuf, sizeof(double)) == sizeof(double))	// 阈值
	{
		strBuf.Format(_T("%lf"), doubleBuf);
		m_imagePage.m_thresholdEdit.SetWindowText(strBuf);
	}
	else
		m_imagePage.m_thresholdEdit.SetWindowText(_T("2.43"));

	gzclose(f);
	return;

UseDefaultOptions:
	m_keywordsPage.m_list.ResetContent();					// 违规内容
	m_blackListPage.m_list.ResetContent();					// 屏蔽用户
	m_whiteListPage.m_list.ResetContent();					// 信任用户
	m_whiteContentPage.m_list.ResetContent();				// 信任内容
	m_imagePage.m_updateImage = TRUE;						// 违规图片
	m_prefPage.m_scanIntervalEdit.SetWindowText(_T("5"));	// 扫描间隔
//.........这里部分代码省略.........
开发者ID:kangtion,项目名称:TiebaManager,代码行数:101,代码来源:SettingDlg.cpp

示例13: SkipWhiteSpace

const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
{
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p ) return 0;

	int tabsize = 4;
	if ( document )
		tabsize = document->TabSize();

	if ( data )
	{
		data->Stamp( p, encoding );
		location = data->Cursor();
	}
	// Read the name, the '=' and the value.
	const char* pErr = p;
	p = ReadName( p, &name, encoding );
	if ( !p || !*p )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
		return 0;
	}
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p || *p != '=' )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
		return 0;
	}

	++p;	// skip '='
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
		return 0;
	}
	
	const char* end;

	if ( *p == '\'' )
	{
		++p;
		end = "\'";
		p = ReadText( p, &value, false, end, false, encoding );
	}
	else if ( *p == '"' )
	{
		++p;
		end = "\"";
		p = ReadText( p, &value, false, end, false, encoding );
	}
	else
	{
		// All attribute values should be in single or double quotes.
		// But this is such a common error that the parser will try
		// its best, even without them.
		value = "";
		while (    p && *p										// existence
				&& !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r'	// whitespace
				&& *p != '/' && *p != '>' )						// tag end
		{
			value += *p;
			++p;
		}
	}
	return p;
}
开发者ID:Avatarchik,项目名称:Unity-Optitrack,代码行数:67,代码来源:tinyxmlparser.cpp

示例14: SkipWhiteSpace

const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
{
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p ) return 0;

//	int tabsize = 4;
//	if ( document )
//		tabsize = document->TabSize();

	if ( data )
	{
		data->Stamp( p, encoding );
		location = data->Cursor();
	}
	// Read the name, the '=' and the value.
	const char* pErr = p;
	p = ReadName( p, &name, encoding );
	if ( !p || !*p )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
		return 0;
	}
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p || *p != '=' )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
		return 0;
	}

	++p;	// skip '='
	p = SkipWhiteSpace( p, encoding );
	if ( !p || !*p )
	{
		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
		return 0;
	}
	
	const char* end;
	const char SINGLE_QUOTE = '\'';
	const char DOUBLE_QUOTE = '\"';

	if ( *p == SINGLE_QUOTE )
	{
		++p;
		end = "\'";		// single quote in string
		p = ReadText( p, &value, false, end, false, encoding );
	}
	else if ( *p == DOUBLE_QUOTE )
	{
		++p;
		end = "\"";		// double quote in string
		p = ReadText( p, &value, false, end, false, encoding );
	}
	else
	{
		// All attribute values should be in single or double quotes.
		// But this is such a common error that the parser will try
		// its best, even without them.
		value = "";
		while (    p && *p											// existence
				&& !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r'	// whitespace
				&& *p != '/' && *p != '>' )							// tag end
		{
			if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
				// [ 1451649 ] Attribute values with trailing quotes not handled correctly
				// We did not have an opening quote but seem to have a 
				// closing one. Give up and throw an error.
				if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
				return 0;
			}
			value += *p;
			++p;
		}
	}
	return p;
}
开发者ID:269629151,项目名称:Gaea,代码行数:76,代码来源:tinyxmlparser.cpp

示例15: ReadText

void  MenuObjC::ReadDefaultObjectHeader()
{
    char tempStr[40];
    ReadText(tempStr, 40);
    ReadObjectHeader();
}
开发者ID:jjayne,项目名称:nSIGHTS,代码行数:6,代码来源:C_MenuObj.cpp


注:本文中的ReadText函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。