Example #1
0
        public STAT_CHUNK GetChunk()
        {
            // Get the managed chunk
            ManagedChunk managedChunk = _implementation.GetChunk();

            if (managedChunk == null)
            {
                // End of chunks.

                if (ThrowOnEndOfChunks)
                {
                    // Throw exception.
                    throw new COMException(SR.Get(SRID.FilterEndOfChunks),
                        (int)FilterErrorCode.FILTER_E_END_OF_CHUNKS);
                }

                // Return STAT_CHUNK with idChunk as 0.

                STAT_CHUNK chunk = new STAT_CHUNK();
                chunk.idChunk = 0;
                return chunk;

            }

            // Valid chunk. Return corresponding STAT_CHUNK.
            return MarshalChunk(managedChunk);
        }
Example #2
0
        internal static STAT_CHUNK MarshalChunk(ManagedChunk chunk)
        {
            STAT_CHUNK native = new STAT_CHUNK();

            native.idChunk = chunk.ID;
            Invariant.Assert(chunk.BreakType >= CHUNK_BREAKTYPE.CHUNK_NO_BREAK && chunk.BreakType <= CHUNK_BREAKTYPE.CHUNK_EOC);
            native.breakType = chunk.BreakType;
            Invariant.Assert(    
                chunk.Flags >= 0 
                && 
                chunk.Flags <= (CHUNKSTATE.CHUNK_TEXT | CHUNKSTATE.CHUNK_VALUE | CHUNKSTATE.CHUNK_FILTER_OWNED_VALUE));
            native.flags = chunk.Flags;
            native.locale = chunk.Locale;
            native.idChunkSource = chunk.ChunkSource;
            native.cwcStartSource = chunk.StartSource;
            native.cwcLenSource = chunk.LenSource;
            MarshalFullPropSpec(chunk.Attribute, ref native.attribute);

            return native;
        }