704c03b9e6
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17200 a95241bf-73f2-0310-859d-f6bbb57e9c96
61 lines
1.2 KiB
C++
61 lines
1.2 KiB
C++
/*
|
|
* Copyright 2001-2006, Haiku.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* Erik Jaesler (erik@cgsoftware.com)
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
*/
|
|
#ifndef _TOKEN_SPACE_H
|
|
#define _TOKEN_SPACE_H
|
|
|
|
|
|
#include <map>
|
|
#include <stack>
|
|
|
|
#include <BeBuild.h>
|
|
#include <Locker.h>
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
// token types as specified in targets
|
|
#define B_PREFERRED_TOKEN -2 /* A little bird told me about this one */
|
|
#define B_NULL_TOKEN -1
|
|
#define B_ANY_TOKEN 0
|
|
|
|
// token types in the token list
|
|
#define B_HANDLER_TOKEN 1
|
|
#define B_SERVER_TOKEN 2
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
class BTokenSpace : public BLocker {
|
|
public:
|
|
BTokenSpace();
|
|
~BTokenSpace();
|
|
|
|
int32 NewToken(int16 type, void* object);
|
|
void SetToken(int32 token, int16 type, void* object);
|
|
|
|
bool RemoveToken(int32 token);
|
|
bool CheckToken(int32 token, int16 type) const;
|
|
status_t GetToken(int32 token, int16 type, void** object) const;
|
|
|
|
private:
|
|
struct token_info {
|
|
int16 type;
|
|
void* object;
|
|
};
|
|
typedef std::map<int32, token_info> TokenMap;
|
|
|
|
TokenMap fTokenMap;
|
|
int32 fTokenCount;
|
|
};
|
|
|
|
extern _IMPEXP_BE BTokenSpace gDefaultTokens;
|
|
|
|
} // namespace BPrivate
|
|
|
|
#endif // _TOKEN_SPACE_H
|