// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_BASE_IME_CHARACTER_COMPOSER_H_
#define UI_BASE_IME_CHARACTER_COMPOSER_H_
#pragma once

#include <vector>

#include "base/basictypes.h"
#include "base/string_util.h"

namespace ui {

// A class to recognize compose and dead key sequence.
// Outputs composed character.
//
// TODO(hashimoto): support unicode character composition starting with
// Ctrl-Shift-U. http://crosbug.com/15925
class CharacterComposer {
 public:
  CharacterComposer();
  ~CharacterComposer();

  void Reset();

  // Filters keypress.
  // Returns true if the keypress is recognized as a part of composition
  // sequence.
  bool FilterKeyPress(unsigned int keycode);

  // Returns a string consisting of composed character.
  // Empty string is returned when there is no composition result.
  const string16& composed_character() const {
    return composed_character_;
  }

 private:
  // Remembers keypresses previously filtered.
  std::vector<unsigned int> compose_buffer_;

  // A string representing the composed character.
  string16 composed_character_;

  DISALLOW_COPY_AND_ASSIGN(CharacterComposer);
};

}  // namespace ui

#endif  // UI_BASE_IME_CHARACTER_COMPOSER_H_

// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_BASE_IME_CHARACTER_COMPOSER_H_
#define UI_BASE_IME_CHARACTER_COMPOSER_H_
#pragma once

#include <vector>

#include "base/basictypes.h"
#include "base/string_util.h"
#include "ui/base/ui_export.h"

namespace ui {

// A class to recognize compose and dead key sequence.
// Outputs composed character.
//
// TODO(hashimoto): support unicode character composition starting with
// Ctrl-Shift-U. http://crosbug.com/15925
class UI_EXPORT CharacterComposer {
 public:
  CharacterComposer();
  ~CharacterComposer();

  void Reset();

  // Filters keypress.
  // Returns true if the keypress is recognized as a part of composition
  // sequence.
  bool FilterKeyPress(unsigned int keycode);

  // Returns a string consisting of composed character.
  // Empty string is returned when there is no composition result.
  const string16& composed_character() const {
    return composed_character_;
  }

 private:
  // Remembers keypresses previously filtered.
  std::vector<unsigned int> compose_buffer_;

  // A string representing the composed character.
  string16 composed_character_;

  DISALLOW_COPY_AND_ASSIGN(CharacterComposer);
};

}  // namespace ui

#endif  // UI_BASE_IME_CHARACTER_COMPOSER_H_

Fix link error when component=shared_library is set
Fix link error when component=shared_library is set


BUG=103789
TEST=Manual


Review URL: http://codereview.chromium.org/8515013

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@109554 0039d316-1c4b-4281-b951-d872f2087c98
