コード例 #1
0
ファイル: serialize.cpp プロジェクト: 540444923/vmbkp
void getAsString(std::string& out, std::istream& is)
{
	std::getline(is, out, '\0');
	if (is.fail()) {
        throw ExceptionStack("getAsString", __FILE__, __LINE__);
    }
}
コード例 #2
0
ファイル: environment.cpp プロジェクト: ObiVaNN/libjpeg
/// Assignment operator for the environment
class Environ &Environ::operator=(class Environ &env)
{
  class ExceptionStack *es,*prev;
  //
  m_First        = ExceptionStack();
  m_Root         = ExceptionRoot(&m_First);
  m_WarnRoot     = ExceptionRoot(&m_First);
  //
  // Copy the parent node over.
  m_pParent      = env.m_pParent;
  //
  // Now carry the active exeption stack frames over
  prev           = NULL;
  es             = env.m_Root.m_pActive;
  while(es->m_pPrevious) { 
    // repeat until we find the first dummy exception stack frame
    prev         = es;
    if (m_Root.m_pActive->m_pPrevious == NULL)
      m_Root.m_pActive = es;
    es->m_pRoot  = &(this->m_Root);
    es           = es->m_pPrevious;
  }
  // Now link the "prev" into our first if we have any
  if (prev) 
    prev->m_pPrevious        = &(m_First);
  //
  // Now fill in the hooks from the supplied tag list
  m_pAllocationHook          = env.m_pAllocationHook;
  m_pReleaseHook             = env.m_pReleaseHook;
  //
  m_pExceptionHook           = env.m_pExceptionHook;
  m_pWarningHook             = env.m_pWarningHook;
  //
  // Now fill in the tags for the allocator
  m_AllocationTags[0].ti_Tag = JPGTAG_MIO_SIZE;
  m_AllocationTags[1].ti_Tag = JPGTAG_MIO_TYPE;
  m_AllocationTags[2]        = env.m_AllocationTags[2];
  m_AllocationTags[3].ti_Tag = JPGTAG_TAG_DONE;
  //
  // now go for the tags for the memory release
  m_ReleaseTags[0].ti_Tag    = env.m_ReleaseTags[0].ti_Tag;
  m_ReleaseTags[1].ti_Tag    = JPGTAG_MIO_MEMORY;
  m_ReleaseTags[2].ti_Tag    = JPGTAG_MIO_RELEASE_USERDATA;
  m_ReleaseTags[2]           = env.m_ReleaseTags[2];
  m_ReleaseTags[3].ti_Tag    = JPGTAG_TAG_DONE;
  //
  // Fill in the exception tags
  m_ExceptionTags[0].ti_Tag  = JPGTAG_EXC_ERROR;
  m_ExceptionTags[1].ti_Tag  = JPGTAG_EXC_CLASS;
  m_ExceptionTags[2].ti_Tag  = JPGTAG_EXC_LINE;
  m_ExceptionTags[3].ti_Tag  = JPGTAG_EXC_SOURCE;
  m_ExceptionTags[4].ti_Tag  = JPGTAG_EXC_DESCRIPTION;
  m_ExceptionTags[5]         = env.m_ExceptionTags[5];
  m_ExceptionTags[6].ti_Tag  = JPGTAG_TAG_DONE;
  //
  // and finally for the warning hook
  m_WarningTags[0].ti_Tag    = JPGTAG_EXC_ERROR;
  m_WarningTags[1].ti_Tag    = JPGTAG_EXC_CLASS;
  m_WarningTags[2].ti_Tag    = JPGTAG_EXC_LINE;
  m_WarningTags[3].ti_Tag    = JPGTAG_EXC_SOURCE;
  m_WarningTags[4].ti_Tag    = JPGTAG_EXC_DESCRIPTION;
  m_WarningTags[5].ti_Tag    = JPGTAG_EXC_WARNING_USERDATA;
  m_WarningTags[5]           = env.m_WarningTags[5];
  m_WarningTags[6].ti_Tag    = JPGTAG_TAG_DONE;
  
  // Clean the exception root as indicator
  // whether we shall check the memory that remains allocated.
  env.m_Root.m_pActive       = NULL;
  //
  CleanWarnQueue();
  //
  return *this;
}