3939// -----------------------------------------------------------------------------
4040// Forward declarations.
4141// -----------------------------------------------------------------------------
42+ void export_irecipientfilter (scope);
4243void export_mrecipientfilter (scope);
4344
4445
@@ -47,81 +48,114 @@ void export_mrecipientfilter(scope);
4748// -----------------------------------------------------------------------------
4849DECLARE_SP_SUBMODULE (_filters, _recipients)
4950{
51+ export_irecipientfilter (_recipients);
5052 export_mrecipientfilter (_recipients);
5153}
5254
5355
56+ // -----------------------------------------------------------------------------
57+ // Exports IRecipientFilter
58+ // -----------------------------------------------------------------------------
59+ void export_irecipientfilter (scope _recipients)
60+ {
61+ class_<IRecipientFilter, IRecipientFilter*, boost::noncopyable> BaseRecipientFilter (" BaseRecipientFilter" , no_init);
62+
63+ // Special methods...
64+ BaseRecipientFilter.def (" __len__" ,
65+ &IRecipientFilter::GetRecipientCount,
66+ " Return the recipient count."
67+ );
68+
69+ BaseRecipientFilter.def (" get_recipient_index" ,
70+ &IRecipientFilter::GetRecipientIndex,
71+ " Obtains the player index at the slot in the filter" ,
72+ args (" slot" )
73+ );
74+
75+ BaseRecipientFilter.def (" __getitem__" ,
76+ &IRecipientFilterExt::__getitem__,
77+ " Obtains the player index at the slot in the filter" ,
78+ args (" index" )
79+ );
80+
81+ // Methods...
82+ BaseRecipientFilter.def (" is_reliable" ,
83+ &IRecipientFilter::IsReliable,
84+ " Whether this recipient filter will be network reliable (sent in-order)"
85+ );
86+
87+ BaseRecipientFilter.def (" is_init_message" ,
88+ &IRecipientFilter::IsInitMessage,
89+ " Whether the message has been initialised?"
90+ );
91+
92+ BaseRecipientFilter.def (" get_recipient_index" ,
93+ &IRecipientFilter::GetRecipientIndex,
94+ " Obtains the player index at the slot in the filter" ,
95+ args (" slot" )
96+ );
97+
98+ // Add memory tools...
99+ BaseRecipientFilter ADD_MEM_TOOLS (IRecipientFilter);
100+ }
101+
102+
54103// -----------------------------------------------------------------------------
55104// Exports MRecipientFilter
56105// -----------------------------------------------------------------------------
57106void export_mrecipientfilter (scope _recipients)
58107{
59- class_<IRecipientFilter, IRecipientFilter*, boost::noncopyable>(" BaseRecipientFilter" , no_init)
60- .def (" is_reliable" ,
61- &IRecipientFilter::IsReliable,
62- " Whether this recipient filter will be network reliable (sent in-order)"
63- )
64-
65- .def (" is_init_message" ,
66- &IRecipientFilter::IsInitMessage,
67- " Whether the message has been initialised?"
68- )
69-
70- .def (" __len__" ,
71- &IRecipientFilter::GetRecipientCount,
72- " Return the recipient count."
73- )
74-
75- .def (" get_recipient_index" ,
76- &IRecipientFilter::GetRecipientIndex,
77- " Obtains the player index at the slot in the filter" ,
78- args (" slot" )
79- )
80-
81- .def (" __getitem__" ,
82- &IRecipientFilterExt::__getitem__,
83- " Obtains the player index at the slot in the filter" ,
84- args (" index" )
85- )
86-
87- ADD_MEM_TOOLS (IRecipientFilter)
88- ;
89-
90- class_<MRecipientFilter, boost::shared_ptr<MRecipientFilter>, bases<IRecipientFilter>, boost::noncopyable >(" _RecipientFilter" )
91- .def (" add_all_players" ,
92- &MRecipientFilter::AddAllPlayers,
93- " Adds all the players on the server to the filter"
94- )
95-
96- .def (" add_recipient" ,
97- &MRecipientFilter::AddRecipient,
98- " Adds the index of the player to the filter" ,
99- args (" index" )
100- )
101-
102- .def (" remove_all_players" ,
103- &MRecipientFilter::RemoveAllPlayers,
104- " Removes all the players on the server from the filter"
105- )
106-
107- .def (" remove_recipient" ,
108- &MRecipientFilter::RemoveRecipient,
109- " Removes the index of the player from the filter" ,
110- args (" index" )
111- )
112-
113- .def (" __contains__" ,
114- &MRecipientFilter::HasRecipient,
115- " Return True if the given index is in the recipient filter." ,
116- args (" index" )
117- )
118-
119- .def_readwrite (" reliable" ,
120- &MRecipientFilter::m_bReliable,
121- " Get/set whether or not the filter is reliable.\n\n "
122- " :rtype: bool"
123- )
124-
125- ADD_MEM_TOOLS (MRecipientFilter)
126- ;
108+ class_<MRecipientFilter, boost::shared_ptr<MRecipientFilter>, bases<IRecipientFilter>, boost::noncopyable > _RecipientFilter (" _RecipientFilter" );
109+
110+ // Constructors...
111+ CLASSMETHOD (_RecipientFilter,
112+ " from_abstract_pointer" ,
113+ &MRecipientFilter::from_abstract_pointer,
114+ " Returns a new recipient filter instance filled with the indexes contained in the given IRecipientFilter pointer.\n "
115+ " \n "
116+ " .. note::\n "
117+ " No checks is done on the given pointer and it is assumed to be valid. Do not use this "
118+ " constructor if you don't know what you are doing. This should really only be used to wrap "
119+ " the content of recipient filters that do not have RTTI data (e.g. during the execution of certain hooks, etc.)." ,
120+ args (" cls" , " pointer" )
121+ );
122+
123+ // Special methods...
124+ _RecipientFilter.def (" __contains__" ,
125+ &MRecipientFilter::HasRecipient,
126+ " Return True if the given index is in the recipient filter." ,
127+ args (" index" )
128+ );
129+
130+ // Methods...
131+ _RecipientFilter.def (" add_all_players" ,
132+ &MRecipientFilter::AddAllPlayers,
133+ " Adds all the players on the server to the filter"
134+ );
135+
136+ _RecipientFilter.def (" add_recipient" ,
137+ &MRecipientFilter::AddRecipient,
138+ " Adds the index of the player to the filter" ,
139+ args (" index" )
140+ );
141+
142+ _RecipientFilter.def (" remove_all_players" ,
143+ &MRecipientFilter::RemoveAllPlayers,
144+ " Removes all the players on the server from the filter"
145+ );
146+
147+ _RecipientFilter.def (" remove_recipient" ,
148+ &MRecipientFilter::RemoveRecipient,
149+ " Removes the index of the player from the filter" ,
150+ args (" index" )
151+ );
152+
153+ _RecipientFilter.def_readwrite (" reliable" ,
154+ &MRecipientFilter::m_bReliable,
155+ " Get/set whether or not the filter is reliable.\n\n "
156+ " :rtype: bool"
157+ );
158+
159+ // Add memory tools...
160+ _RecipientFilter ADD_MEM_TOOLS (MRecipientFilter);
127161}
0 commit comments