replace tabs
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@452 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
3f7449d7bc
commit
5a3972d804
5 changed files with 66 additions and 60 deletions
|
@ -1350,19 +1350,19 @@ namespace Loki
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct BinderFirstBoundTypeStorage;
|
struct BinderFirstBoundTypeStorage;
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct BinderFirstBoundTypeStorage
|
struct BinderFirstBoundTypeStorage
|
||||||
{
|
{
|
||||||
typedef typename TypeTraits<T>::ParameterType RefOrValue;
|
typedef typename TypeTraits<T>::ParameterType RefOrValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, class TList, template <class> class ThreadingModel>
|
template <typename R, class TList, template <class> class ThreadingModel>
|
||||||
struct BinderFirstBoundTypeStorage< Functor<R, TList, ThreadingModel> >
|
struct BinderFirstBoundTypeStorage< Functor<R, TList, ThreadingModel> >
|
||||||
{
|
{
|
||||||
typedef Functor<R, TList, ThreadingModel> OriginalFunctor;
|
typedef Functor<R, TList, ThreadingModel> OriginalFunctor;
|
||||||
typedef const typename TypeTraits<OriginalFunctor>::ReferredType RefOrValue;
|
typedef const typename TypeTraits<OriginalFunctor>::ReferredType RefOrValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1383,7 +1383,7 @@ namespace Loki
|
||||||
typedef typename Private::BinderFirstTraits<OriginalFunctor>::Impl Base;
|
typedef typename Private::BinderFirstTraits<OriginalFunctor>::Impl Base;
|
||||||
typedef typename OriginalFunctor::ResultType ResultType;
|
typedef typename OriginalFunctor::ResultType ResultType;
|
||||||
|
|
||||||
typedef typename OriginalFunctor::Parm1 BoundType;
|
typedef typename OriginalFunctor::Parm1 BoundType;
|
||||||
|
|
||||||
typedef typename Private::BinderFirstBoundTypeStorage<
|
typedef typename Private::BinderFirstBoundTypeStorage<
|
||||||
typename Private::BinderFirstTraits<OriginalFunctor>
|
typename Private::BinderFirstTraits<OriginalFunctor>
|
||||||
|
@ -1491,7 +1491,7 @@ namespace Loki
|
||||||
typename Private::BinderFirstTraits<Fctor>::BoundFunctorType
|
typename Private::BinderFirstTraits<Fctor>::BoundFunctorType
|
||||||
BindFirst(
|
BindFirst(
|
||||||
const Fctor& fun,
|
const Fctor& fun,
|
||||||
typename Fctor::Parm1 bound)
|
typename Fctor::Parm1 bound)
|
||||||
{
|
{
|
||||||
typedef typename Private::BinderFirstTraits<Fctor>::BoundFunctorType
|
typedef typename Private::BinderFirstTraits<Fctor>::BoundFunctorType
|
||||||
Outgoing;
|
Outgoing;
|
||||||
|
|
|
@ -500,7 +500,7 @@ bool Chunk::IsCorrupt( unsigned char numBlocks, std::size_t blockSize,
|
||||||
bool Chunk::IsBlockAvailable( void * p, unsigned char numBlocks,
|
bool Chunk::IsBlockAvailable( void * p, unsigned char numBlocks,
|
||||||
std::size_t blockSize ) const
|
std::size_t blockSize ) const
|
||||||
{
|
{
|
||||||
(void) numBlocks;
|
(void) numBlocks;
|
||||||
|
|
||||||
if ( IsFilled() )
|
if ( IsFilled() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -1220,6 +1220,9 @@ bool SmallObjAllocator::IsCorrupt( void ) const
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.25 2006/01/09 07:27:00 syntheticpp
|
||||||
|
// replace tabs
|
||||||
|
//
|
||||||
// Revision 1.24 2006/01/07 03:24:10 lfittl
|
// Revision 1.24 2006/01/07 03:24:10 lfittl
|
||||||
// Removed useless "using namespace Loki;".
|
// Removed useless "using namespace Loki;".
|
||||||
//
|
//
|
||||||
|
|
|
@ -243,7 +243,7 @@ void heap_debug()
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
heap_debug();
|
heap_debug();
|
||||||
|
|
||||||
reg();
|
reg();
|
||||||
|
|
||||||
|
@ -283,12 +283,12 @@ int main()
|
||||||
|
|
||||||
|
|
||||||
cout << endl;
|
cout << endl;
|
||||||
cout << "Registered ids: \n";
|
cout << "Registered ids: \n";
|
||||||
|
|
||||||
std::vector<std::string> ids = PFactory::Instance().RegisteredIds();
|
std::vector<std::string> ids = PFactory::Instance().RegisteredIds();
|
||||||
|
|
||||||
for(std::vector<std::string>::iterator it=ids.begin(); it!=ids.end(); ++it)
|
for(std::vector<std::string>::iterator it=ids.begin(); it!=ids.end(); ++it)
|
||||||
cout << *it << "\n";
|
cout << *it << "\n";
|
||||||
|
|
||||||
|
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
@ -303,6 +303,9 @@ int main()
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.13 2006/01/09 07:27:01 syntheticpp
|
||||||
|
// replace tabs
|
||||||
|
//
|
||||||
// Revision 1.12 2006/01/05 00:23:43 syntheticpp
|
// Revision 1.12 2006/01/05 00:23:43 syntheticpp
|
||||||
// always use #include <loki/...>, Thanks to Lukas Fittl
|
// always use #include <loki/...>, Thanks to Lukas Fittl
|
||||||
//
|
//
|
||||||
|
|
|
@ -21,38 +21,38 @@
|
||||||
|
|
||||||
struct UserDatabase
|
struct UserDatabase
|
||||||
{
|
{
|
||||||
void AddFriend(const std::string&, const std::string&)
|
void AddFriend(const std::string&, const std::string&)
|
||||||
{
|
{
|
||||||
throw 55;
|
throw 55;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
User(UserDatabase* db) : pDB_(db){}
|
User(UserDatabase* db) : pDB_(db){}
|
||||||
|
|
||||||
std::string GetName();
|
std::string GetName();
|
||||||
|
|
||||||
void AddFriend(User& newFriend);
|
void AddFriend(User& newFriend);
|
||||||
void AddFriendGuarded(User& newFriend);
|
void AddFriendGuarded(User& newFriend);
|
||||||
|
|
||||||
size_t countFriends();
|
size_t countFriends();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector<User*> UserCont;
|
typedef std::vector<User*> UserCont;
|
||||||
UserCont friends_;
|
UserCont friends_;
|
||||||
UserDatabase* pDB_;
|
UserDatabase* pDB_;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string User::GetName()
|
std::string User::GetName()
|
||||||
{
|
{
|
||||||
return "A name";
|
return "A name";
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t User::countFriends()
|
size_t User::countFriends()
|
||||||
{
|
{
|
||||||
return friends_.size();
|
return friends_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void User::AddFriend(User& newFriend)
|
void User::AddFriend(User& newFriend)
|
||||||
|
@ -64,7 +64,7 @@ void User::AddFriend(User& newFriend)
|
||||||
void User::AddFriendGuarded(User& newFriend)
|
void User::AddFriendGuarded(User& newFriend)
|
||||||
{
|
{
|
||||||
friends_.push_back(&newFriend);
|
friends_.push_back(&newFriend);
|
||||||
Loki::ScopeGuard guard = Loki::MakeObjGuard(friends_, &UserCont::pop_back);
|
Loki::ScopeGuard guard = Loki::MakeObjGuard(friends_, &UserCont::pop_back);
|
||||||
pDB_->AddFriend(GetName(), newFriend.GetName());
|
pDB_->AddFriend(GetName(), newFriend.GetName());
|
||||||
guard.Dismiss();
|
guard.Dismiss();
|
||||||
}
|
}
|
||||||
|
@ -72,18 +72,18 @@ void User::AddFriendGuarded(User& newFriend)
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
UserDatabase db;
|
UserDatabase db;
|
||||||
|
|
||||||
User u1(&db);
|
User u1(&db);
|
||||||
User u2(&db);
|
User u2(&db);
|
||||||
|
|
||||||
try{ u1.AddFriend(u2); }
|
try{ u1.AddFriend(u2); }
|
||||||
catch (...){}
|
catch (...){}
|
||||||
std::cout << "u1 countFriends: " << u1.countFriends() << "\n";
|
std::cout << "u1 countFriends: " << u1.countFriends() << "\n";
|
||||||
|
|
||||||
try{ u2.AddFriendGuarded(u1); }
|
try{ u2.AddFriendGuarded(u1); }
|
||||||
catch (...){}
|
catch (...){}
|
||||||
std::cout << "u2 countFriends: " << u2.countFriends() << "\n";
|
std::cout << "u2 countFriends: " << u2.countFriends() << "\n";
|
||||||
|
|
||||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||||
system("PAUSE");
|
system("PAUSE");
|
||||||
|
|
|
@ -19,63 +19,63 @@
|
||||||
class Base : public Loki::BaseVisitable<>
|
class Base : public Loki::BaseVisitable<>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LOKI_DEFINE_VISITABLE()
|
LOKI_DEFINE_VISITABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
class Type1 : public Base
|
class Type1 : public Base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LOKI_DEFINE_VISITABLE()
|
LOKI_DEFINE_VISITABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
class VariableVisitor :
|
class VariableVisitor :
|
||||||
public Loki::BaseVisitor,
|
public Loki::BaseVisitor,
|
||||||
//public Loki::Visitor<Base>,
|
//public Loki::Visitor<Base>,
|
||||||
//public Loki::Visitor<Type1>
|
//public Loki::Visitor<Type1>
|
||||||
public Loki::Visitor<LOKI_TYPELIST_2(Base,Type1)>
|
public Loki::Visitor<LOKI_TYPELIST_2(Base,Type1)>
|
||||||
//public Loki::Visitor<Loki::Seq<Base,Type1>::Type>
|
//public Loki::Visitor<Loki::Seq<Base,Type1>::Type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Visit(Base&){std::cout << "void Visit(Base&)\n";}
|
void Visit(Base&){std::cout << "void Visit(Base&)\n";}
|
||||||
void Visit(Type1&){std::cout << "void Visit(Type1&)\n";}
|
void Visit(Type1&){std::cout << "void Visit(Type1&)\n";}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CBase : public Loki::BaseVisitable<void, Loki::DefaultCatchAll, true>
|
class CBase : public Loki::BaseVisitable<void, Loki::DefaultCatchAll, true>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LOKI_DEFINE_CONST_VISITABLE()
|
LOKI_DEFINE_CONST_VISITABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
class CType1 : public CBase
|
class CType1 : public CBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LOKI_DEFINE_CONST_VISITABLE()
|
LOKI_DEFINE_CONST_VISITABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
class CVariableVisitor :
|
class CVariableVisitor :
|
||||||
public Loki::BaseVisitor,
|
public Loki::BaseVisitor,
|
||||||
//public Loki::Visitor<CBase,void,true>,
|
//public Loki::Visitor<CBase,void,true>,
|
||||||
//public Loki::Visitor<CType1,void,true>
|
//public Loki::Visitor<CType1,void,true>
|
||||||
public Loki::Visitor<LOKI_TYPELIST_2(CBase,CType1),void,true>
|
public Loki::Visitor<LOKI_TYPELIST_2(CBase,CType1),void,true>
|
||||||
//public Loki::Visitor<Loki::Seq<CBase,CType1>::Type,void,true>
|
//public Loki::Visitor<Loki::Seq<CBase,CType1>::Type,void,true>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Visit(const CBase&){std::cout << "void Visit(CBase&)\n";}
|
void Visit(const CBase&){std::cout << "void Visit(CBase&)\n";}
|
||||||
void Visit(const CType1&){std::cout << "void Visit(CType1&)\n";}
|
void Visit(const CType1&){std::cout << "void Visit(CType1&)\n";}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
VariableVisitor visitor;
|
VariableVisitor visitor;
|
||||||
Type1 type1;
|
Type1 type1;
|
||||||
Base* dyn = &type1;
|
Base* dyn = &type1;
|
||||||
dyn->Accept(visitor);
|
dyn->Accept(visitor);
|
||||||
|
|
||||||
CVariableVisitor cvisitor;
|
CVariableVisitor cvisitor;
|
||||||
CType1 ctype1;
|
CType1 ctype1;
|
||||||
CBase* cdyn = &ctype1;
|
CBase* cdyn = &ctype1;
|
||||||
cdyn->Accept(cvisitor);
|
cdyn->Accept(cvisitor);
|
||||||
|
|
||||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||||
system("PAUSE");
|
system("PAUSE");
|
||||||
|
|
Loading…
Add table
Reference in a new issue