vfs: check userland buffers before reading them.
[haiku.git] / headers / os / app / Clipboard.h
blob066ceb0493bcf1843c497ca103c0ca0b4a5de398
1 /*
2 * Copyright 2007-2009, Haiku Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Author:
6 * Gabe Yoder, gyoder@stny.rr.com
7 */
8 #ifndef _CLIPBOARD_H
9 #define _CLIPBOARD_H
12 #include <BeBuild.h>
13 #include <Locker.h>
14 #include <Messenger.h>
16 class BMessage;
19 enum {
20 B_CLIPBOARD_CHANGED = 'CLCH'
23 class BClipboard {
24 public:
25 BClipboard(const char* name,
26 bool transient = false);
27 virtual ~BClipboard();
29 const char* Name() const;
31 uint32 LocalCount() const;
32 uint32 SystemCount() const;
33 status_t StartWatching(BMessenger target);
34 status_t StopWatching(BMessenger target);
36 bool Lock();
37 void Unlock();
38 bool IsLocked() const;
40 status_t Clear();
41 status_t Commit();
42 status_t Commit(bool failIfChanged);
43 status_t Revert();
45 BMessenger DataSource() const;
46 BMessage* Data() const;
48 private:
49 BClipboard(const BClipboard&);
50 BClipboard& operator=(const BClipboard&);
52 virtual void _ReservedClipboard1();
53 virtual void _ReservedClipboard2();
54 virtual void _ReservedClipboard3();
56 bool _AssertLocked() const;
57 status_t _DownloadFromSystem(bool force = false);
58 status_t _UploadToSystem();
60 uint32 _reserved0;
61 BMessage* fData;
62 BLocker fLock;
63 BMessenger fClipHandler;
64 BMessenger fDataSource;
65 uint32 fCount;
66 char* fName;
67 uint32 _reserved[4];
70 extern BClipboard* be_clipboard;
72 #endif // _CLIPBOARD_H