#include <list>
#include <string>
#include <zypp/base/Logger.h>
+#include <zypp/base/Exception.h>
#include <zypp/base/String.h>
#include <zypp/base/IOStream.h>
#include <zypp/base/PtrTypes.h>
#include <iostream>
-#include "zypp/base/Logger.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/Exception.h"
-#include "zypp/base/Fd.h"
-#include "zypp/Pathname.h"
+#include <ctime>
+
+#include <fstream>
+#include <list>
+#include <string>
+#include <zypp/base/Logger.h>
+#include <zypp/base/String.h>
+#include <zypp/base/IOStream.h>
+#include <zypp/base/PtrTypes.h>
+
+#include <zypp/CapFactory.h>
+#include <zypp/CapSet.h>
using namespace std;
using namespace zypp;
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
+namespace zypp
+{
+ struct foo : public base::ReferenceCounted
+ {
+ };
+}
/******************************************************************
**
-**
** FUNCTION NAME : main
** FUNCTION TYPE : int
-**
-** DESCRIPTION :
*/
int main( int argc, char * argv[] )
{
INT << "===[START]==========================================" << endl;
- base::Fd( "packages", O_RDONLY );
+ foo f;
+ SEC << f << endl;
INT << "===[END]============================================" << endl;
return 0;
typedef TraitsType::KindType Kind;
typedef TraitsType::PtrType Ptr;
typedef TraitsType::constPtrType constPtr;
- friend std::ostream & operator<<( std::ostream & str, const Resolvable & obj );
public:
/** */
inline typename ResTraits<_Res>::constPtrType asKind( const Resolvable::constPtr & p )
{ return dynamic_pointer_cast<const _Res>(p); }
- ///////////////////////////////////////////////////////////////////
-
- /** \relates Resolvable Stream output via Resolvable::dumpOn */
- inline std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
- { return obj.dumpOn( str ); }
-
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
*
*/
#include <iostream>
+#include <sstream>
#include "zypp/base/Logger.h"
#include "zypp/base/String.h"
Exception::~Exception() throw()
{}
-#if 0
std::string Exception::asString() const
{
- std::string ret( _where.asString() );
- ret += ": ";
- return ret += _msg;
+ std::ostringstream str;
+ dumpOn( str );
+ return str.str();
}
-#endif
std::ostream & Exception::dumpOn( std::ostream & str ) const
{
* 44 {
* 45 try
* 46 {
- * 47 ZYPP_THROW( Exception, "Something bad happened." );
+ * 47 ZYPP_THROW_MSG( Exception, "Something bad happened." );
* 48 }
* 49 catch ( Exception & excpt )
* 50 {
void relocate( const CodeLocation & where_r ) const
{ _where = where_r; }
- /** Return the provided message string. */
+ /** Return the message string provided to the ctor. */
const std::string & msg() const
{ return _msg; }
- /** Return message string. */
- virtual const char * what() const throw()
- { return _msg.c_str(); }
-
- /** Exception as string */
+ /** A proper error message. */
std::string asString() const;
protected:
static std::string strErrno( int errno_r, const std::string & msg_r );
public:
- /** Drop a logline. */
+ /** Drop a logline on throw, catch or rethrow.
+ * Used by \ref ZYPP_THROW macros.
+ */
static void log( const Exception & excpt_r, const CodeLocation & where_r,
const char *const prefix_r );
mutable CodeLocation _where;
std::string _msg;
+ /** Return message string. */
+ virtual const char * what() const throw()
+ { return _msg.c_str(); }
+
/** Called by <tt>std::ostream & operator\<\<</tt> */
std::ostream & dumpError( std::ostream & str ) const;
};
return asString() < rhs->asString();
}
- /******************************************************************
- **
- ** FUNCTION NAME : operator<<
- ** FUNCTION TYPE : std::ostream &
- */
- std::ostream & operator<<( std::ostream & str, const CapabilityImpl & obj )
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : CapabilityImpl::capImplOrderLess
+ // METHOD TYPE : bool
+ //
+ std::ostream & CapabilityImpl::dumpOn( std::ostream & str ) const
{
- return str << '[' << obj.refers() << "] "
- << '(' << obj.kind() << ") "
- << obj.asString();
+ return str << '[' << refers() << "] "
+ << '(' << kind() << ") "
+ << asString();
}
/////////////////////////////////////////////////////////////////
virtual bool matches( Resolvable::constPtr resolvable_r,
solver::Context_constPtr solverContext_r ) const = 0;
+ protected:
+ /** Helper for stream output. */
+ virtual std::ostream & dumpOn( std::ostream & str ) const;
+
private:
/** Kind of Resolvable \c this refers to. */
Resolvable::Kind _refers;
}
};
- ///////////////////////////////////////////////////////////////////
-
- /** \relates CapabilityImpl Stream output */
- extern std::ostream & operator<<( std::ostream & str, const CapabilityImpl & obj );
-
/////////////////////////////////////////////////////////////////
} // namespace capability
///////////////////////////////////////////////////////////////////