blip  0.1
Intent.hpp
Go to the documentation of this file.
1 #ifndef __blip_Intent_hpp
2 #define __blip_Intent_hpp
3 
4 #include <jni.h>
5 
6 #include <blip/Blip.hpp>
7 
8 #include <commonc++/Flags.h++>
9 #include <commonc++/JavaException.h++>
10 #include <commonc++/String.h++>
11 
12 CCXX_FWD_DECL(JavaVirtualMachine);
13 
14 namespace blip {
15 
16 class JavaGlue;
17 class NativeActivity;
18 
19 class Intent
20 {
21  friend class NativeActivity;
22 
23  public:
24 
25  virtual ~Intent();
26 
27  ccxx::String getAction() const;
28  Intent& setAction(const ccxx::String& action);
29 
30  ccxx::String getData() const;
31  Intent& setData(const ccxx::String& data);
32 
33  ccxx::Flags<int32_t> getFlags() const;
34  Intent& setFlags(const ccxx::Flags<int32_t>& flags);
35 
36  bool getBooleanExtra(const ccxx::String& name, bool defaultValue = false)
37  const;
38  int32_t getIntExtra(const ccxx::String& name, int32_t defaultValue = 0)
39  const;
40  int32_t getIntExtra(const char* name, int32_t defaultValue = 0) const;
41  int64_t getLongExtra(const ccxx::String& name,
42  const int64_t& defaultValue = 0) const;
43  float getFloatExtra(const ccxx::String& name, float defaultValue = 0.0f)
44  const;
45  double getDoubleExtra(const ccxx::String& name,
46  const double& defaultValue = 0.0) const;
47  ccxx::String getStringExtra(const ccxx::String& name) const;
48  ccxx::String getStringExtra(const char* name) const;
49 
50  Intent& putExtra(const ccxx::String& name, bool value);
51  Intent& putExtra(const ccxx::String& name, int32_t value);
52  Intent& putExtra(const ccxx::String& name, const int64_t& value);
53  Intent& putExtra(const ccxx::String& name, float value);
54  Intent& putExtra(const ccxx::String& name, const double& value);
55  Intent& putExtra(const ccxx::String& name, const ccxx::String& value);
56 
57  bool hasExtra(const ccxx::String& name) const;
58 
59  void removeExtra(const ccxx::String& name);
60 
61  private:
62 
63  Intent(ccxx::JavaVirtualMachine* jvm, const JavaGlue& java, jobject object);
64 
65  ccxx::JavaVirtualMachine* _jvm;
66  const JavaGlue& _java;
67  mutable jclass _class;
68  mutable jobject _object;
69 };
70 
71 } // namespace blip
72 
73 #endif // __blip_Intent_hpp
virtual ~Intent()
Definition: Intent.cpp:32
Definition: Intent.hpp:19
int32_t getIntExtra(const ccxx::String &name, int32_t defaultValue=0) const
ccxx::Flags< int32_t > getFlags() const
Definition: Intent.cpp:91
ccxx::String getStringExtra(const ccxx::String &name) const
Intent & setAction(const ccxx::String &action)
Definition: Intent.cpp:52
Intent & putExtra(const ccxx::String &name, bool value)
ccxx::String getAction() const
Definition: Intent.cpp:42
WAV file format details at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
Definition: AccelerometerSensorEvent.cpp:3
CCXX_FWD_DECL(JavaVirtualMachine)
An abstract base class for all "native" (C++) Android activities.
Definition: NativeActivity.hpp:71
ccxx::String getData() const
Definition: Intent.cpp:65
void removeExtra(const ccxx::String &name)
Definition: Intent.cpp:304
Intent & setFlags(const ccxx::Flags< int32_t > &flags)
Definition: Intent.cpp:101
bool getBooleanExtra(const ccxx::String &name, bool defaultValue=false) const
Definition: Intent.cpp:114
bool hasExtra(const ccxx::String &name) const
Definition: Intent.cpp:294
float getFloatExtra(const ccxx::String &name, float defaultValue=0.0f) const
Definition: Intent.cpp:165
Intent & setData(const ccxx::String &data)
Definition: Intent.cpp:75
int64_t getLongExtra(const ccxx::String &name, const int64_t &defaultValue=0) const
Definition: Intent.cpp:152
double getDoubleExtra(const ccxx::String &name, const double &defaultValue=0.0) const
Definition: Intent.cpp:178