Exemple #1
0
//-*****************************************************************************
OrData::~OrData()
{
    CloseObject( m_oldGroup );
    if ( m_children )
    {
        delete [] m_children;
    }
}
     CACObject :: ~CACObject ( )
{

  if ( db_handle )
    CloseObject();
  


}
Exemple #3
0
void PDF::CloseStream()
   {
   int length = ftell(file) - stream_start;

   fprintf(file, "\nendstream");
   CloseObject();

   WriteInteger(length_index, length);
   }
Exemple #4
0
void NFCNet::ExecuteClose()
{
    for (int i = 0; i < mvRemoveObject.size(); ++i)
    {
        int nSocketIndex = mvRemoveObject[i];
        CloseObject(nSocketIndex);
    }

    mvRemoveObject.clear();
}
Exemple #5
0
void CWsPointerCursor::CommandL(TInt aOpcode, const TAny *aCmdData)
	{
	switch(aOpcode)
		{
		case EWsSpriteOpFree:
			CloseObject();
			break;
		default:
			CWsSpriteBase::CommandL(aOpcode, aCmdData);
			break;
		}
	}
Exemple #6
0
void PDF::CloseFile()
   {
   if (file == NULL)
      return;

   page.ClosePage();

   // If the PDF document is empty, add an empty
   // page to ensure well formed document.
   if (page.GetPageNumber() == 0)
      {
      page.OpenPage();
      page.ClosePage();
      }

   info.Write(*this);
   page.WritePageTree();
   font.WriteDictionary();

   int catalogue = GetObject();
   OpenObject(catalogue);
   OpenDictionary();

   WriteName("Type", "Catalog");
   WriteReference("Pages", page.tree_index);

   CloseDictionary();
   CloseObject();

   int trailer_offset = ftell(file);

   fprintf(file, "xref\n");
   fprintf(file, "0 %d\n", objects.Length() );
   fprintf(file, "0000000000 65535 f \n");

   for (int i = 1; i < objects.Length(); i++)
      fprintf(file, "%010d 00000 n \n", objects[i]);

   fprintf(file, "trailer\n");

   fprintf(file, "<<\n");
   fprintf(file, "/Size %d\n", objects.Length());
   fprintf(file, "/Root %d 0 R\n", catalogue);
   fprintf(file, "/Info %d 0 R\n", info.object);
   fprintf(file, ">>\n");

   fprintf(file, "startxref\n");
   fprintf(file, "%d\n", trailer_offset);
   fprintf(file, "%%%%EOF");

   fclose(file);
   file = NULL;
   }
Exemple #7
0
//-*****************************************************************************
const AbcA::ObjectHeader &
OrData::getChildHeader( AbcA::ObjectReaderPtr iParent, size_t i )
{
    ABCA_ASSERT( i < m_children.size(),
        "Out of range index in OrData::getChildHeader: " << i );

    Alembic::Util::scoped_lock l( m_childObjectsMutex );
    if ( ! m_children[i].loadedMetaData )
    {
        H5Node group = OpenGroup( m_group,
            m_children[i].header->getName().c_str() );
;
        ABCA_ASSERT( group.isValidObject(),
        "Could not open object group: "
        << m_children[i].header->getFullName() );

        ReadMetaData( group, ".prop.meta",
            m_children[i].header->getMetaData() );

        CloseObject( group );
    }

    return *( m_children[i].header );
}
Exemple #8
0
//-*****************************************************************************
CprData::~CprData()
{
    delete[] m_subPropertyMutexes;
    CloseObject( m_group );
}
void IPEManager::Close()
{
	CloseObject();
	CloseManager();
}
Exemple #10
0
JSBool
js_ConsumeJSONText(JSContext *cx, JSONParser *jp, const jschar *data, uint32 len)
{
    uint32 i;
 
    if (*jp->statep == JSON_PARSE_STATE_INIT) {
        PushState(jp, JSON_PARSE_STATE_OBJECT_VALUE);
    }
 
    for (i = 0; i < len; i++) {        
        jschar c = data[i];
        switch (*jp->statep) {
            case JSON_PARSE_STATE_VALUE :
                if (c == ']') {
                    // empty array
                    if (!PopState(jp))
                        return JS_FALSE;
                    if (*jp->statep != JSON_PARSE_STATE_ARRAY) 
                        return JS_FALSE; // unexpected char
                    if (!CloseArray(cx, jp) || !PopState(jp))
                        return JS_FALSE;
                    break;
                }
 
                if (c == '}') {
                    // we should only find these in OBJECT_KEY state
                    return JS_FALSE; // unexpected failure
                }
 
                if (c == '"') {
                    *jp->statep = JSON_PARSE_STATE_STRING;
                    break;
                } 
 
                if (IsNumChar(c)) {
                    *jp->statep = JSON_PARSE_STATE_NUMBER;
                    js_AppendChar(jp->buffer, c);
                    break;
                }
 
                if (JS7_ISLET(c)) {
                    *jp->statep = JSON_PARSE_STATE_KEYWORD;
                    js_AppendChar(jp->buffer, c);
                    break;
                }
 
            // fall through in case the value is an object or array
            case JSON_PARSE_STATE_OBJECT_VALUE :
                if (c == '{') {
                  *jp->statep = JSON_PARSE_STATE_OBJECT;
                  if (!OpenObject(cx, jp) || !PushState(jp, JSON_PARSE_STATE_OBJECT_PAIR))
                      return JS_FALSE;
                } else if (c == '[') {
                  *jp->statep = JSON_PARSE_STATE_ARRAY;
                  if (!OpenArray(cx, jp) || !PushState(jp, JSON_PARSE_STATE_VALUE))
                      return JS_FALSE;
                } else if (!JS_ISXMLSPACE(c)) {
                  return JS_FALSE; // unexpected
                }
                break;
 
            case JSON_PARSE_STATE_OBJECT :
                if (c == '}') {                    
                    if (!CloseObject(cx, jp) || !PopState(jp))
                        return JS_FALSE;
                } else if (c == ',') {
                    if (!PushState(jp, JSON_PARSE_STATE_OBJECT_PAIR))
                        return JS_FALSE;
                } else if (c == ']' || !JS_ISXMLSPACE(c)) {
                    return JS_FALSE; // unexpected
                }
                break;
 
            case JSON_PARSE_STATE_ARRAY :
                if (c == ']') {
                    if (!CloseArray(cx, jp) || !PopState(jp))
                        return JS_FALSE;
                } else if (c == ',') {
                    if (!PushState(jp, JSON_PARSE_STATE_VALUE))
                        return JS_FALSE;
                } else if (!JS_ISXMLSPACE(c)) {
                    return JS_FALSE; // unexpected
                }
                break;
            case JSON_PARSE_STATE_OBJECT_PAIR :
                if (c == '"') {
                    // we want to be waiting for a : when the string has been read
                    *jp->statep = JSON_PARSE_STATE_OBJECT_IN_PAIR;
                    if (!PushState(jp, JSON_PARSE_STATE_STRING))
                        return JS_FALSE;
                } else if (c == '}') {
                    // pop off the object pair state and the object state
                    if (!CloseObject(cx, jp) || !PopState(jp) || !PopState(jp))
                        return JS_FALSE;
                } else if (c == ']' || !JS_ISXMLSPACE(c)) {
                  return JS_FALSE; // unexpected
                }
                break;
            case JSON_PARSE_STATE_OBJECT_IN_PAIR:
                if (c == ':') {
                    *jp->statep = JSON_PARSE_STATE_VALUE;
                } else if (!JS_ISXMLSPACE(c)) {
                    return JS_FALSE; // unexpected
                }
                break;
            case JSON_PARSE_STATE_STRING:
                if (c == '"') {
                    if (!PopState(jp))
                        return JS_FALSE;
                    JSONDataType jdt;
                    if (*jp->statep == JSON_PARSE_STATE_OBJECT_IN_PAIR) {
                        jdt = JSON_DATA_KEYSTRING;
                    } else {
                        jdt = JSON_DATA_STRING;
                    }
                    if (!HandleData(cx, jp, jdt, jp->buffer->base, STRING_BUFFER_OFFSET(jp->buffer)))
                        return JS_FALSE;
                } else if (c == '\\') {
                    *jp->statep = JSON_PARSE_STATE_STRING_ESCAPE;
                } else {
                    js_AppendChar(jp->buffer, c);
                }
                break;
        
            case JSON_PARSE_STATE_STRING_ESCAPE:
                switch(c) {
                    case '"':
                    case '\\':
                    case '/':
                        break;
                    case 'b' : c = '\b'; break;
                    case 'f' : c = '\f'; break;
                    case 'n' : c = '\n'; break;
                    case 'r' : c = '\r'; break;
                    case 't' : c = '\t'; break;
                    default :
                        if (c == 'u') {
                            jp->numHex = 0;
                            jp->hexChar = 0;
                            *jp->statep = JSON_PARSE_STATE_STRING_HEX;
                            continue;
                        } else {
                            return JS_FALSE; // unexpected
                        }
                }
 
                js_AppendChar(jp->buffer, c);
                *jp->statep = JSON_PARSE_STATE_STRING;
                break;
            case JSON_PARSE_STATE_STRING_HEX:
                if (('0' <= c) && (c <= '9'))
                  jp->hexChar = (jp->hexChar << 4) | (c - '0');
                else if (('a' <= c) && (c <= 'f'))
                  jp->hexChar = (jp->hexChar << 4) | (c - 'a' + 0x0a);
                else if (('A' <= c) && (c <= 'F'))
                  jp->hexChar = (jp->hexChar << 4) | (c - 'A' + 0x0a);
                else
                  return JS_FALSE; // unexpected
 
                if (++(jp->numHex) == 4) {
                    js_AppendChar(jp->buffer, jp->hexChar);
                    jp->hexChar = 0;
                    jp->numHex = 0;
                    *jp->statep = JSON_PARSE_STATE_STRING;
                }
                break;
            case JSON_PARSE_STATE_KEYWORD:
                if (JS7_ISLET(c)) {
                    js_AppendChar(jp->buffer, c);
                } else {
                    // this character isn't part of the keyword, process it again
                    i--;
                    if(!PopState(jp))
                        return JS_FALSE;
                
                    if (!HandleData(cx, jp, JSON_DATA_KEYWORD, jp->buffer->base, STRING_BUFFER_OFFSET(jp->buffer)))
                        return JS_FALSE;
                }
                break;
            case JSON_PARSE_STATE_NUMBER:
                if (IsNumChar(c)) {
                    js_AppendChar(jp->buffer, c);
                } else {
                    // this character isn't part of the number, process it again
                    i--;
                    if(!PopState(jp))
                        return JS_FALSE;
                    if (!HandleData(cx, jp, JSON_DATA_NUMBER, jp->buffer->base, STRING_BUFFER_OFFSET(jp->buffer)))
                        return JS_FALSE;
                }
                break;
            case JSON_PARSE_STATE_FINISHED:
                if (!JS_ISXMLSPACE(c))
                  return JS_FALSE; // extra input
 
                break;
            default:
                JS_NOT_REACHED("Invalid JSON parser state");
      }
    }
 
    return JS_TRUE;
}
Exemple #11
0
static JSBool
CloseArray(JSContext *cx, JSONParser *jp)
{
  return CloseObject(cx, jp);
}
//-*****************************************************************************
ArImpl::ArImpl( const std::string &iFileName,
                AbcA::ReadArraySampleCachePtr iCache,
                const bool iCacheHierarchy )
  : m_fileName( iFileName )
  , m_file( -1 )
  , m_readArraySampleCache( iCache )
{
    // OPEN THE FILE!
    htri_t exi = H5Fis_hdf5( m_fileName.c_str() );
    ABCA_ASSERT( exi == 1, "Nonexistent or not an Alembic file: "
        << m_fileName );

    m_file = H5Fopen( m_fileName.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT );
    ABCA_ASSERT( m_file >= 0,
                 "Could not open file: " << m_fileName );

    // get the version using HDF5 native calls
    int version = -INT_MAX;
    if (H5Aexists(m_file, "abc_version"))
    {
        size_t numRead = 0;
        ReadSmallArray(m_file, "abc_version",  H5T_STD_I32LE, H5T_NATIVE_INT32,
            1, numRead, &version);
    }
    ABCA_ASSERT(version >= -8 && version <= ALEMBIC_HDF5_FILE_VERSION,
        "Unsupported file version detected: " << version);

    // if it isn't there, it's pre 1.0
    int fileVersion = 9999;
    if (H5Aexists( m_file, "abc_release_version" ))
    {
        size_t numRead = 0;
        ReadSmallArray( m_file, "abc_release_version", H5T_STD_I32LE,
            H5T_NATIVE_INT32, 1, numRead, &fileVersion );
    }
    m_archiveVersion = fileVersion;

    HDF5HierarchyReader reader( m_file, m_H5H, iCacheHierarchy );
    H5Node node = m_H5H.createNode( m_file );
    H5Node abcRoot = OpenGroup( node, "ABC" );

    AbcA::MetaData metaData;
    ReadMetaData( abcRoot, ".prop.meta", metaData );
    m_header.reset( new AbcA::ObjectHeader( "ABC", "/", metaData ) );

    m_data.reset( new OrData( m_header, node, m_archiveVersion ) );
    CloseObject( abcRoot );
    ReadTimeSamples( m_file, m_timeSamples );

    if ( H5Aexists( m_file, "abc_max_samples" ) )
    {
        hid_t aid = H5Aopen( m_file, "abc_max_samples", H5P_DEFAULT );

        if ( aid < 0 )
        {
            return;
        }

        AttrCloser attrCloser( aid );

        // figure out how big it is
        hid_t sid = H5Aget_space( aid );

        if ( sid < 0 )
        {
            return;
        }

        DspaceCloser dspaceCloser( sid );

        hssize_t numPoints = H5Sget_simple_extent_npoints( sid );

        if ( numPoints < 1 )
        {
            return;
        }

        m_maxSamples.resize( numPoints );

        // do the read
        H5Aread( aid, H5T_NATIVE_LLONG, &( m_maxSamples.front() ) );

    }
}
Exemple #13
0
//-*****************************************************************************
OrData::~OrData()
{
    CloseObject( m_oldGroup );
}
Exemple #14
0
void PDF::WriteString(int object, const char * string)
   {
   OpenObject(object);
   WriteString(string);
   CloseObject();
   }
Exemple #15
0
void PDF::WriteInteger(int object, int integer)
   {
   OpenObject(object);
   WriteInteger(integer);
   CloseObject();
   }