scmstream.h revision 62b88df0b51ed81807d485b371b90aff7dfd7bee
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * IPRT Testcase / Tool - Source Code Massager Stream Code.
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * Copyright (C) 2012 Oracle Corporation
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * available from http://www.virtualbox.org. This file is free software;
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * General Public License (GPL) as published by the Free Software
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e99772f9bf09219c532812c859fbeea513c67e65vboxsync/** End of line marker type. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync/** Pointer to an end of line marker type. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * Line record.
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The offset of the line. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The line length, excluding the LF character.
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * @todo This could be derived from the offset of the next line if that wasn't
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * so tedious. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The end of line marker type. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync/** Pointer to a line record. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync * Source code massager stream.
e99772f9bf09219c532812c859fbeea513c67e65vboxsynctypedef struct SCMSTREAM
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** Pointer to the file memory. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The current stream position. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The current stream size. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The size of the memory pb points to. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** Line records. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The current line. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The current stream size given in lines. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** The sizeof the the memory backing paLines. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** Set if write-only, clear if read-only. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** Set if the memory pb points to is from RTFileReadAll. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** Set if fully broken into lines. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync /** Stream status code (IPRT). */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync/** Pointer to a SCM stream. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsync/** Pointer to a const SCM stream. */
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamInitForReading(PSCMSTREAM pStream, const char *pszFilename);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamInitForWriting(PSCMSTREAM pStream, PCSCMSTREAM pRelatedStream);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamWriteToFile(PSCMSTREAM pStream, const char *pszFilenameFmt, ...);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamSeekAbsolute(PSCMSTREAM pStream, size_t offAbsolute);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamSeekRelative(PSCMSTREAM pStream, ssize_t offRelative);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamSeekByLine(PSCMSTREAM pStream, size_t iLine);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncconst char *ScmStreamGetLineByNo(PSCMSTREAM pStream, size_t iLine, size_t *pcchLine, PSCMEOL penmEol);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncconst char *ScmStreamGetLine(PSCMSTREAM pStream, size_t *pcchLine, PSCMEOL penmEol);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamRead(PSCMSTREAM pStream, void *pvBuf, size_t cbToRead);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncbool ScmStreamIsWhiteLine(PSCMSTREAM pStream, size_t iLine);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncSCMEOL ScmStreamGetEolByLine(PSCMSTREAM pStream, size_t iLine);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamPutLine(PSCMSTREAM pStream, const char *pchLine, size_t cchLine, SCMEOL enmEol);
e99772f9bf09219c532812c859fbeea513c67e65vboxsyncint ScmStreamWrite(PSCMSTREAM pStream, const char *pchBuf, size_t cchBuf);