[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/andschar/rstudio/master/src/cpp/core/Error.cpp [Back]  [Original]

/*
 * Error.cpp
 *
 * Copyright (C) 2009-12 by RStudio, Inc.
 *
 * Unless you have received this program directly from RStudio pursuant
 * to the terms of a commercial license agreement with RStudio, then
 * this program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */

#include 
#include 

#include 

#include 
#include 

#include 

#ifdef _WIN32
#include 
#endif

namespace rstudio {
namespace core {

struct Error::Impl
{
   boost::system::error_code ec ;
   ErrorProperties properties ;
   Error cause ;
   ErrorLocation location ;
};

Error::Error()
   : pImpl_()
{
}

Error::Error(const boost::system::error_code& ec, 
             const ErrorLocation& location)
   : pImpl_(new Impl()) 
{
   pImpl_->ec = ec ;
   pImpl_->location = location ;
}
   
Error::Error(const boost::system::error_code& ec,
             const Error& cause,
             const ErrorLocation& location)
   : pImpl_(new Impl()) 
{
   pImpl_->ec = ec ;
   pImpl_->cause = cause ;
   pImpl_->location = location ;
}
   
 
Error::~Error() 
{
}

void Error::copyOnWrite()
{
   if ( (pImpl_.get() != NULL) && !pImpl_.unique())
   {
      Impl* pOldImpl = pImpl_.get() ;
      pImpl_ = boost::shared_ptr(new Impl(*pOldImpl)) ;
   }
}

const boost::system::error_code& Error::code() const
{
   return impl().ec;
}

   
std::string Error::summary() const
{
   std::ostringstream ostr;
   ostr file ;
}

long ErrorLocation::line() const
{
   return pImpl_->line ;
}
   
std::string ErrorLocation::asString() const
{
   std::ostringstream ostr ;
   ostr 

Web Proxy Viewer  |  New URL  |  Original Page