/usr/lib/Wt/examples/codeview/CodeSession.h is in witty-examples 3.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2010 Emweb bvba, Heverlee, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef CODE_SESSION_H_
#define CODE_SESSION_H_
#include <Wt/WString>
#include <Wt/WSignal>
#include <vector>
#include <boost/thread.hpp>
class CodeSession
{
public:
enum BufferUpdate {
Inserted,
Deleted,
Changed
};
struct Buffer {
Wt::WString name;
Wt::WString text;
};
typedef boost::function<void(int, BufferUpdate)> BufferCallback;
typedef boost::function<void(void)> CoderCallback;
CodeSession(const CoderCallback& coderCallback);
~CodeSession();
std::string id() const { return id_; }
static CodeSession *
addObserver(const std::string& id, const BufferCallback& bufferCallback);
void removeObserver();
void removeCoder();
void insertBuffer(int index);
void updateBuffer(int buffer, const Wt::WString& name,
const Wt::WString& text);
std::vector<Buffer> buffers() const;
Buffer buffer(int buffer) const;
int observerCount() const { return observers_.size(); }
private:
typedef boost::recursive_mutex::scoped_lock Lock;
struct Coder {
std::string sessionId;
CoderCallback callback;
};
struct Observer {
std::string sessionId;
BufferCallback callback;
};
std::string id_;
std::vector<Buffer> buffers_;
std::vector<Observer> observers_;
Coder *coder_;
static std::vector<CodeSession *> sessions_;
static boost::recursive_mutex mutex_;
void generateId();
void deleteIfEmpty();
void postSessionChanged();
void postBufferChanged(int buffer, BufferUpdate update);
};
#endif // CODE_SESSION_H_
|