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


C++ PODOFO_RAISE_ERROR函数代码示例

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


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

示例1: PODOFO_RAISE_ERROR

void PdfOutputDevice::Seek( size_t offset )
{
    if( m_hFile )
    {
        if( fseeko( m_hFile, offset, SEEK_SET ) == -1 )
        {
            PODOFO_RAISE_ERROR( ePdfError_ValueOutOfRange );
        }
    }
    else if( m_pBuffer )
    {
        if( offset >= m_lBufferLen )
        {
            PODOFO_RAISE_ERROR( ePdfError_ValueOutOfRange );
        }
    }
    else if( m_pStream )
    {
        m_pStream->seekp( offset, std::ios_base::beg );
    }
    else if( m_pRefCountedBuffer ) 
    {
        m_ulPosition = offset;
    }

    m_ulPosition = offset;
    // Seek should not change the length of the device
    // m_ulLength = offset;
}
开发者ID:ispringsolutions,项目名称:PoDoFo,代码行数:29,代码来源:PdfOutputDevice.cpp

示例2: PODOFO_RAISE_ERROR

pdf_long PdfMemoryOutputStream::Write( const char* pBuffer, pdf_long lLen )
{
    if( !m_pBuffer ) 
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    if( m_lLen + lLen > m_lSize ) 
    {
        if( m_bOwnBuffer )
        {
            // a reallocation is required
            m_lSize = PDF_MAX( (m_lLen + lLen), (m_lSize << 1 ) );
            m_pBuffer = static_cast<char*>(podofo_realloc( m_pBuffer, m_lSize ));
            if( !m_pBuffer ) 
            {
                PODOFO_RAISE_ERROR( ePdfError_OutOfMemory );
            }
        }
        else
        {
            PODOFO_RAISE_ERROR( ePdfError_OutOfMemory );
        }
    }

    memcpy( m_pBuffer + m_lLen, pBuffer, lLen );
    m_lLen += lLen;

    return lLen;
}
开发者ID:ispringsolutions,项目名称:PoDoFo,代码行数:30,代码来源:PdfOutputStream.cpp

示例3: PODOFO_RAISE_ERROR

PdfOutputDevice::PdfOutputDevice( const char* pszFilename )
{
    this->Init();

    if( !pszFilename ) 
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

	std::fstream *pStream = new std::fstream(pszFilename, std::fstream::binary|std::ios_base::in | std::ios_base::out | std::ios_base::trunc);
	if(pStream->fail()) {
		PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
	}
	m_pStream = pStream;
	m_pReadStream = pStream;
    PdfLocaleImbue(*m_pStream);

    /*
    m_hFile = fopen( pszFilename, "wb" );
    if( !m_hFile )
    {
        PODOFO_RAISE_ERROR_INFO( ePdfError_FileNotFound, pszFilename );
    }
    */
}
开发者ID:TodorGrin,项目名称:boox-opensource,代码行数:25,代码来源:PdfOutputDevice.cpp

示例4: GetObject

void PdfTilingPattern::AddToResources(const PdfName &rIdentifier, const PdfReference &rRef, const PdfName &rName)
{
	PdfObject* pResource = GetObject()->GetDictionary().GetKey( "Resources" );

	if( !pResource ) {
		PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
	}

	if( !pResource->GetDictionary().HasKey( rName ) ) {
		pResource->GetDictionary().AddKey( rName, PdfDictionary() );
	}
	if (ePdfDataType_Reference == pResource->GetDictionary().GetKey( rName )->GetDataType()) {
		PdfObject *directObject = pResource->GetOwner()->GetObject(pResource->GetDictionary().GetKey( rName )->GetReference());

		if (0 == directObject) {
         PODOFO_RAISE_ERROR( ePdfError_NoObject );
		}

		if( !directObject->GetDictionary().HasKey( rIdentifier ) )
         directObject->GetDictionary().AddKey( rIdentifier, rRef );
	}else {
		if( !pResource->GetDictionary().GetKey( rName )->GetDictionary().HasKey( rIdentifier ) )
         pResource->GetDictionary().GetKey( rName )->GetDictionary().AddKey( rIdentifier, rRef );
	}
}
开发者ID:ispringsolutions,项目名称:PoDoFo,代码行数:25,代码来源:PdfTilingPattern.cpp

示例5: PODOFO_RAISE_ERROR

void PdfSignOutputDevice::SetSignature(const PdfData &sigData)
{
    if(!m_bBeaconFound) {
        PODOFO_RAISE_ERROR( ePdfError_InternalLogic );
    }
    size_t maxSigSize = m_pSignatureBeacon->data().size();
    size_t sigByteSize = sigData.data().size();
    // check signature size
    if((sigByteSize*2)> maxSigSize) {
        PODOFO_RAISE_ERROR( ePdfError_ValueOutOfRange );
    }
    PdfString sig(sigData.data().c_str(), sigByteSize, true);

    m_pRealDevice->Seek(m_sBeaconPos);
    sig.Write(m_pRealDevice, PoDoFo::ePdfWriteMode_Compact);
    // insert padding
    size_t numPadding = maxSigSize-2*sigByteSize;
    if(numPadding>0) {
        // Seek back
        m_pRealDevice->Seek(m_pRealDevice->Tell()-1);
        while(numPadding>0) {
            char c='0';
            m_pRealDevice->Write(&c, 1);
            numPadding--;
        }
    }
}
开发者ID:TodorGrin,项目名称:boox-opensource,代码行数:27,代码来源:PdfSignOutputDevice.cpp

示例6: PODOFO_RAISE_ERROR

PdfAnnotation* PdfPage::GetAnnotation( int index )
{
    PdfAnnotation* pAnnot;
    PdfReference   ref;

    PdfObject*     pObj   = this->GetAnnotationsArray( false );

    if( !(pObj && pObj->IsArray()) )
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
    }
    
    if( index < 0 && static_cast<unsigned int>(index) >= pObj->GetArray().size() )
    {
        PODOFO_RAISE_ERROR( ePdfError_ValueOutOfRange );
    }

    ref    = pObj->GetArray()[index].GetReference();
    pAnnot = m_mapAnnotations[ref];
    if( !pAnnot )
    {
        pObj = m_pObject->GetOwner()->GetObject( ref );
        if( !pObj )
        {
            PdfError::DebugMessage( "Error looking up object %i %i R\n", ref.ObjectNumber(), ref.GenerationNumber() );
            PODOFO_RAISE_ERROR( ePdfError_NoObject );
        }
     
        pAnnot = new PdfAnnotation( pObj, this );
        m_mapAnnotations[ref] = pAnnot;
    }

    return pAnnot;
}
开发者ID:arunjalota,项目名称:paperman,代码行数:34,代码来源:PdfPage.cpp

示例7: PODOFO_RAISE_ERROR

void PdfPagesTree::DeletePage( int nPageNumber )
{
    // Delete from cache
    m_cache.DeletePage( nPageNumber );
    
    // Delete from pages tree
    PdfObjectList lstParents;
    PdfObject* pPageNode = this->GetPageNode( nPageNumber, this->GetRoot(), lstParents );

    if( !pPageNode ) 
    {
        PdfError::LogMessage( eLogSeverity_Information,
                              "Invalid argument to PdfPagesTree::DeletePage: %i - Page not found\n",
                              nPageNumber );
        PODOFO_RAISE_ERROR( ePdfError_PageNotFound );
    }

    if( lstParents.size() > 0 ) 
    {
        PdfObject* pParent = lstParents.back();
        int nKidsIndex = this->GetPosInKids( pPageNode, pParent );
        
        DeletePageFromNode( pParent, lstParents, nKidsIndex, pPageNode );
    }
    else
    {
        PdfError::LogMessage( eLogSeverity_Error,
                              "PdfPagesTree::DeletePage: Page %i has no parent - cannot be deleted.\n",
                              nPageNumber );
        PODOFO_RAISE_ERROR( ePdfError_PageNotFound );
    }
}
开发者ID:yjwong,项目名称:podofo,代码行数:32,代码来源:PdfPagesTree.cpp

示例8: PODOFO_RAISE_ERROR

void PdfFontSimple::Init( bool bEmbed, const PdfName & rsSubType )
{
    PdfObject*    pWidth;
    PdfObject*    pDescriptor;
    PdfVariant    var;
    PdfArray      array;

    pWidth = this->GetObject()->GetOwner()->CreateObject();
    if( !pWidth )
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    m_pMetrics->GetWidthArray( *pWidth, m_pEncoding->GetFirstChar(), m_pEncoding->GetLastChar(), m_pEncoding );

    pDescriptor = this->GetObject()->GetOwner()->CreateObject( "FontDescriptor" );
    if( !pDescriptor )
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

	std::string name;
	if ( m_bIsSubsetting )
		name = this->GetObject()->GetOwner()->GetNextSubsetPrefix();
	name += this->GetBaseFont().GetName();

    this->GetObject()->GetDictionary().AddKey( PdfName::KeySubtype, rsSubType );
    this->GetObject()->GetDictionary().AddKey("BaseFont", PdfName( name ) );
    this->GetObject()->GetDictionary().AddKey("FirstChar", PdfVariant( static_cast<pdf_int64>(m_pEncoding->GetFirstChar()) ) );
    this->GetObject()->GetDictionary().AddKey("LastChar", PdfVariant( static_cast<pdf_int64>(m_pEncoding->GetLastChar()) ) );
    m_pEncoding->AddToDictionary( this->GetObject()->GetDictionary() ); // Add encoding key

    this->GetObject()->GetDictionary().AddKey("Widths", pWidth->Reference() );
    this->GetObject()->GetDictionary().AddKey( "FontDescriptor", pDescriptor->Reference() );

    m_pMetrics->GetBoundingBox( array );

    pDescriptor->GetDictionary().AddKey( "FontName", PdfName( name ) );
    //pDescriptor->GetDictionary().AddKey( "FontWeight", (long)m_pMetrics->Weight() );
    pDescriptor->GetDictionary().AddKey( PdfName::KeyFlags, PdfVariant( static_cast<pdf_int64>(PODOFO_LL_LITERAL(32)) ) ); // TODO: 0 ????
    pDescriptor->GetDictionary().AddKey( "FontBBox", array );
    pDescriptor->GetDictionary().AddKey( "ItalicAngle", PdfVariant( static_cast<pdf_int64>(m_pMetrics->GetItalicAngle()) ) );
    pDescriptor->GetDictionary().AddKey( "Ascent", m_pMetrics->GetPdfAscent() );
    pDescriptor->GetDictionary().AddKey( "Descent", m_pMetrics->GetPdfDescent() );
    pDescriptor->GetDictionary().AddKey( "CapHeight", m_pMetrics->GetPdfAscent() ); // m_pMetrics->CapHeight() );
    pDescriptor->GetDictionary().AddKey( "StemV", PdfVariant( static_cast<pdf_int64>(PODOFO_LL_LITERAL(1)) ) );               // m_pMetrics->StemV() );

    // Peter Petrov 24 September 2008
    m_pDescriptor = pDescriptor;

    if( bEmbed )
    {
        this->EmbedFontFile( pDescriptor );
        m_bWasEmbedded = true;
    }
}
开发者ID:yjwong,项目名称:podofo,代码行数:56,代码来源:PdfFontSimple.cpp

示例9: PODOFO_RAISE_ERROR

PdfElement::PdfElement( EPdfDataType eExpectedDataType, PdfObject* pObject ) 
{
    if( !pObject )         
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    m_pObject = pObject;

    if( m_pObject->GetDataType() != eExpectedDataType ) 
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
    }
}
开发者ID:TodorGrin,项目名称:boox-opensource,代码行数:14,代码来源:PdfElement.cpp

示例10: PODOFO_RAISE_ERROR

void PdfParser::ReadXRefStreamEntry( char* pBuffer, pdf_long, long lW[W_ARRAY_SIZE], int nObjNo )
{
    int              i, z;
    unsigned long    nData[W_ARRAY_SIZE];

    for( i=0;i<W_ARRAY_SIZE;i++ )
    {
        if( lW[i] > W_MAX_BYTES )
        {
            PdfError::LogMessage( eLogSeverity_Error, "The XRef stream dictionary has an entry in /W of size %i.\nThe maximum supported value is %i.\n", lW[i], W_MAX_BYTES );

            PODOFO_RAISE_ERROR( ePdfError_InvalidXRefStream );
        }

        nData[i] = 0;
        for( z=W_MAX_BYTES-lW[i];z<W_MAX_BYTES;z++ )
        {
            nData[i] = (nData[i] << 8) + static_cast<unsigned char>(*pBuffer);
            ++pBuffer;
        }
    }

    m_offsets[nObjNo].bParsed = true;
    switch( nData[0] ) // nData[0] contains the type information of this entry
    {
        case 0:
            // a free object
            m_offsets[nObjNo].lOffset     = nData[1];
            m_offsets[nObjNo].lGeneration = nData[2];
            m_offsets[nObjNo].cUsed       = 'f';
            break;
        case 1:
            // normal uncompressed object
            m_offsets[nObjNo].lOffset     = nData[1];
            m_offsets[nObjNo].lGeneration = nData[2];
            m_offsets[nObjNo].cUsed       = 'n';
            break;
        case 2:
            // object that is part of an object stream
            m_offsets[nObjNo].lOffset     = nData[2]; // index in the object stream
            m_offsets[nObjNo].lGeneration = nData[1]; // object number of the stream
            m_offsets[nObjNo].cUsed       = 's';      // mark as stream
            break;
        default:
        {
            PODOFO_RAISE_ERROR( ePdfError_InvalidXRefType );
        }
    }
}
开发者ID:arunjalota,项目名称:paperman,代码行数:49,代码来源:PdfParser.cpp

示例11: trailer

void PdfParser::ReadNextTrailer()
{
    // ReadXRefcontents has read the first 't' from "trailer" so just check for "railer"
    if( this->IsNextToken( "trailer" ) )
    //if( strcmp( m_buffer.GetBuffer(), "railer" ) == 0 )
    {
        PdfParserObject trailer( m_vecObjects, m_device, m_buffer );
        try {
            // Ignore the encryption in the trailer as the trailer may not be encrypted
            trailer.ParseFile( NULL, true );
        } catch( PdfError & e ) {
            e.AddToCallstack( __FILE__, __LINE__, "The linearized trailer was found in the file, but contains errors." );
            throw e;
        }

        // now merge the information of this trailer with the main documents trailer
        MergeTrailer( &trailer );

        if( trailer.GetDictionary().HasKey( "Prev" ) )
        {
            try {
                ReadXRefContents( static_cast<pdf_long>(trailer.GetDictionary().GetKeyAsLong( "Prev", 0 )) );
            } catch( PdfError & e ) {
                e.AddToCallstack( __FILE__, __LINE__, "Unable to load /Prev xref entries." );
                throw e;
            }
        }
        else
        {
            PODOFO_RAISE_ERROR( ePdfError_NoTrailer );
        }
    }
}
开发者ID:arunjalota,项目名称:paperman,代码行数:33,代码来源:PdfParser.cpp

示例12: PODOFO_RAISE_ERROR

void PdfAnnotation::SetAppearanceStream( PdfXObject* pObject )
{
    PdfDictionary dict;
    PdfDictionary internal;

    if( !pObject )
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    // when adding #On/Off# entries to #AP#, and set #AS# to "On",
    // will cause desktop adobe pdf reader not showing display content of the Appearance Stream of PolyLine
    // so comment out it, [email protected]

//    internal.AddKey( "On", pObject->GetObject()->Reference() );
//    internal.AddKey( "Off", pObject->GetObject()->Reference() );
//
//    dict.AddKey( "N", internal );
//
//    this->GetObject()->GetDictionary().AddKey( "AP", dict );
//    this->GetObject()->GetDictionary().AddKey( "AS", PdfName("On") );

    dict.AddKey( "N", pObject->GetObject()->Reference() );

    this->GetObject()->GetDictionary().AddKey( "AP", dict );
}
开发者ID:TodorGrin,项目名称:boox-opensource,代码行数:26,代码来源:PdfAnnotation.cpp

示例13: PODOFO_RAISE_ERROR

void PdfFontMetricsFreetype::GetWidthArray( PdfVariant & var, unsigned int nFirst, unsigned int nLast ) const
{
    unsigned int  i;
    PdfArray  list;

    if( !m_pFace ) 
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    for( i=nFirst;i<=nLast;i++ )
    {
        if( i < PODOFO_WIDTH_CACHE_SIZE )
            list.push_back( PdfVariant( m_vecWidth[i] ) );
        else
        {
            if( !FT_Load_Char( m_pFace, i, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) )  // | FT_LOAD_NO_RENDER
            {
                //PODOFO_RAISE_ERROR( ePdfError_FreeType );
                list.push_back( PdfVariant( 0.0 ) );
                continue;
            }

            list.push_back( PdfVariant( m_pFace->glyph->metrics.horiAdvance * 1000.0 / m_pFace->units_per_EM ) );
        }
    }

    var = PdfVariant( list );
}
开发者ID:TodorGrin,项目名称:boox-opensource,代码行数:29,代码来源:PdfFontMetricsFreetype.cpp

示例14: PODOFO_RAISE_ERROR

PdfInputDevice::PdfInputDevice( const wchar_t* pszFilename )
{
    this->Init();

    if( !pszFilename ) 
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    try {
        // James McGill 16.02.2011 Fix wide character filename loading in windows
        m_pFile = _wfopen(pszFilename, L"rb");
        if( !m_pFile)
        {
            PdfError e( ePdfError_FileNotFound, __FILE__, __LINE__ );
            e.SetErrorInformation( pszFilename );
            throw e;
        }
        m_StreamOwned = true;
    }
    catch(...) {
        // should probably check the exact error, but for now it's a good error
        PdfError e( ePdfError_FileNotFound, __FILE__, __LINE__ );
        e.SetErrorInformation( pszFilename );
        throw e;
    }
}
开发者ID:yjwong,项目名称:podofo,代码行数:27,代码来源:PdfInputDevice.cpp

示例15: PdfElement

PdfXObject::PdfXObject( const PdfMemDocument & rDoc, int nPage, PdfDocument* pParent )
    : PdfElement( "XObject", pParent ), PdfCanvas()
{
    m_rRect = PdfRect();

    InitXObject( m_rRect, "XObInd" );

    // Implementation note: source document must be different from distination
    if ( pParent == reinterpret_cast<const PdfDocument*>(&rDoc) )
    {
        PODOFO_RAISE_ERROR( ePdfError_InternalLogic );
    }
    // After filling set correct BBox
    m_rRect = pParent->FillXObjectFromDocumentPage( this, rDoc, nPage );

    PdfVariant    var;
    m_rRect.ToVariant( var );
    m_pObject->GetDictionary().AddKey( "BBox", var );

    PdfArray      matrix;
    matrix.push_back( PdfVariant( 1LL ) );
    matrix.push_back( PdfVariant( 0LL ) );
    matrix.push_back( PdfVariant( 0LL ) );
    matrix.push_back( PdfVariant( 1LL ) );
	if( m_rRect.GetLeft() != 0 )
	    matrix.push_back( PdfVariant( m_rRect.GetLeft() * (-1.0) ) );
	else
	    matrix.push_back( PdfVariant( 0LL ) );
	if( m_rRect.GetBottom() != 0 )
	    matrix.push_back( PdfVariant( m_rRect.GetBottom() * (-1.0) ) );
	else
	    matrix.push_back( PdfVariant( 0LL ) );
    m_pObject->GetDictionary().AddKey( "Matrix", matrix );
}
开发者ID:arunjalota,项目名称:paperman,代码行数:34,代码来源:PdfXObject.cpp


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