2007-07-18 00:26:12 +00:00
|
|
|
%%% Copyright (c) 2007- Facebook
|
|
|
|
%%% Distributed under the Thrift Software License
|
|
|
|
%%%
|
|
|
|
%%% See accompanying file LICENSE or visit the Thrift site at:
|
|
|
|
%%% http://developers.facebook.com/thrift/
|
|
|
|
|
|
|
|
-define(CLASS(Obj), element(1, Obj)).
|
|
|
|
|
2007-09-18 06:23:33 +00:00
|
|
|
-define(DEFINE_ATTR(Attr), attr(This, get, Attr, _Value) -> This#?MODULE.Attr;
|
2007-07-18 00:26:12 +00:00
|
|
|
attr(This, set, Attr, Value) -> This#?MODULE{Attr=Value}
|
|
|
|
).
|
2007-09-18 06:23:33 +00:00
|
|
|
|
2007-07-18 00:26:12 +00:00
|
|
|
%%% static: use only if you're sure This is class ?MODULE and not a super/subclass
|
|
|
|
-define(ATTR(Attr), This#?MODULE.Attr).
|
|
|
|
|
|
|
|
%%% convenience for implementing inspect/1
|
|
|
|
%%% e.g. -> "foo=5"
|
2007-09-18 06:23:33 +00:00
|
|
|
-define(FORMAT_ATTR(Attr),
|
2007-07-18 00:26:12 +00:00
|
|
|
io_lib:write_atom(Attr) ++ "=" ++ io_lib:print(?ATTR(Attr))
|
|
|
|
).
|
|
|
|
|
|
|
|
-define(ATTR_DUMMY,
|
|
|
|
attr(dummy, dummy, dummy, dummy) ->
|
|
|
|
throw(dummy_attr_used)
|
|
|
|
).
|