* Added missing 'const' for the entry_ref paramter of Load(), and Save().

* Cleaned up Keymap.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41331 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2011-05-05 21:35:39 +00:00
parent ab33d547d2
commit 09dc38501a
2 changed files with 32 additions and 32 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2010 Haiku Inc. All rights reserved.
* Copyright 2004-2011 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -115,7 +115,7 @@ Keymap::DumpKeymap()
//! Load a map from a file
status_t
Keymap::Load(entry_ref &ref)
Keymap::Load(const entry_ref& ref)
{
BEntry entry;
status_t status = entry.SetTo(&ref, true);
@@ -128,7 +128,7 @@ Keymap::Load(entry_ref &ref)
return status;
// fetch name from attribute and fall back to filename
ssize_t bytesRead = file.ReadAttr("keymap:name", B_STRING_TYPE, 0, fName,
sizeof(fName));
if (bytesRead > 0)
@@ -142,7 +142,7 @@ Keymap::Load(entry_ref &ref)
//! We save a map to a file
status_t
Keymap::Save(entry_ref& ref)
Keymap::Save(const entry_ref& ref)
{
BFile file;
status_t status = file.SetTo(&ref,
+28 -28
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2010 Haiku Inc. All rights reserved.
* Copyright 2004-2011 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -28,48 +28,48 @@ enum dead_key_index {
class Keymap : public BKeymap {
public:
Keymap();
~Keymap();
Keymap();
~Keymap();
void SetTarget(BMessenger target,
BMessage* modificationMessage);
void SetTarget(BMessenger target,
BMessage* modificationMessage);
status_t Load(entry_ref& ref);
status_t Save(entry_ref& ref);
status_t Load(const entry_ref& ref);
status_t Save(const entry_ref& ref);
void DumpKeymap();
void DumpKeymap();
status_t SetModifier(uint32 keyCode, uint32 modifier);
status_t SetModifier(uint32 keyCode, uint32 modifier);
void SetDeadKeyEnabled(uint32 keyCode, uint32 modifiers,
bool enabled);
void GetDeadKeyTrigger(dead_key_index deadKeyIndex,
BString& outTrigger);
void SetDeadKeyTrigger(dead_key_index deadKeyIndex,
const BString& trigger);
void SetDeadKeyEnabled(uint32 keyCode,
uint32 modifiers, bool enabled);
void GetDeadKeyTrigger(dead_key_index deadKeyIndex,
BString& outTrigger);
void SetDeadKeyTrigger(dead_key_index deadKeyIndex,
const BString& trigger);
status_t Use();
status_t Use();
void SetKey(uint32 keyCode, uint32 modifiers,
int8 deadKey, const char* bytes,
int32 numBytes = -1);
void SetKey(uint32 keyCode, uint32 modifiers,
int8 deadKey, const char* bytes,
int32 numBytes = -1);
void SetName(const char* name);
void SetName(const char* name);
const key_map& Map() const { return fKeys; }
key_map& Map() { return fKeys; }
const key_map& Map() const { return fKeys; }
key_map& Map() { return fKeys; }
Keymap& operator=(const Keymap& other);
Keymap& operator=(const Keymap& other);
private:
bool _SetChars(int32 offset, const char* bytes,
int32 numBytes);
bool _SetChars(int32 offset, const char* bytes,
int32 numBytes);
private:
char fName[B_FILE_NAME_LENGTH];
char fName[B_FILE_NAME_LENGTH];
BMessenger fTarget;
BMessage* fModificationMessage;
BMessenger fTarget;
BMessage* fModificationMessage;
};