Skip to content

Commit

Permalink
Merge pull request #45 from phoepsilonix/develop
Browse files Browse the repository at this point in the history
Update for editon 2021
  • Loading branch information
samunohito authored Nov 4, 2024
2 parents a676fea + 18ca812 commit 3693202
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 23 deletions.
5 changes: 3 additions & 2 deletions kanaria_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "kanaria"
version = "0.2.0"
version = "0.2.1"
authors = ["osamu <[email protected]>"]
edition = "2021"

repository = "https://github.com/samunohito/kanaria"
readme = "../README.md"
Expand All @@ -15,7 +16,7 @@ exclude = [
]

[dependencies]
bitflags = "1.2.1"
bitflags = "2.6.0"

[lib]
name = "kanaria"
Expand Down
2 changes: 1 addition & 1 deletion kanaria_core/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub const CONVERT_TARGET_SYMBOL: u32 = 0b00000100;
/// 半角・全角の変換対象としてカタカナを設定する際のビットフラグです。
pub const CONVERT_TARGET_KATAKANA: u32 = 0b00001000;
/// 半角・全角の変換が可能なものはすべて変換します。
pub const CONVERT_TARGET_ALL: u32 = (CONVERT_TARGET_NUMBER | CONVERT_TARGET_ALPHABET | CONVERT_TARGET_SYMBOL | CONVERT_TARGET_KATAKANA);
pub const CONVERT_TARGET_ALL: u32 = CONVERT_TARGET_NUMBER | CONVERT_TARGET_ALPHABET | CONVERT_TARGET_SYMBOL | CONVERT_TARGET_KATAKANA;

/// 大文字への変換を行う際に設定する値です。
pub const CONVERT_TYPE_UPPER_CASE: u32 = 1;
Expand Down
6 changes: 3 additions & 3 deletions kanaria_core/src/string/ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use UCSChar;
use string::string::UCSStr;
use crate::UCSChar;
use crate::string::string::UCSStr;

impl<T> Clone for UCSStr<T> where T: UCSChar {
fn clone(&self) -> Self {
Expand All @@ -12,4 +12,4 @@ impl<T> Clone for UCSStr<T> where T: UCSChar {
fn clone_from(&mut self, source: &Self) {
*self = source.clone()
}
}
}
5 changes: 3 additions & 2 deletions kanaria_core/src/string/params.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use utils::ConvertTarget;
use crate::utils::ConvertTarget;

#[derive(Debug, PartialEq, Copy, Clone)]
pub enum ConvertType {
Expand Down Expand Up @@ -35,4 +35,5 @@ impl ConvertParameter {
width_convert_target,
}
}
}
}

7 changes: 4 additions & 3 deletions kanaria_core/src/string/string.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use std::char;
use std::slice::from_raw_parts;

use string::params::{ConvertParameter, ConvertType};
use string::params::ConvertType::*;
use utils::{AsciiUtils, KanaUtils, WidthUtils, CharExtend};
use crate::string::params::{ConvertParameter, ConvertType};
use crate::string::params::ConvertType::*;
use crate::utils::{AsciiUtils, KanaUtils, WidthUtils, CharExtend};

use crate::UCSChar;
use crate::utils::ConvertTarget;
use crate::string::ConvertType::{UpperCase, LowerCase, Hiragana, Katakana, Wide, Narrow};

pub struct UCSStr<T> where T: UCSChar {
/// 変換対象文字列を保持します。
Expand Down
6 changes: 3 additions & 3 deletions kanaria_core/src/utils/chars.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use UCSChar;
use utils::{AsciiUtils, KanaUtils};
use crate::UCSChar;
use crate::utils::{AsciiUtils, KanaUtils};

pub struct CharsUtils;

Expand Down Expand Up @@ -60,4 +60,4 @@ impl CharsUtils {
KanaUtils::is_wide_katakana(target) ||
KanaUtils::is_wide_jis_symbol(target)
}
}
}
4 changes: 2 additions & 2 deletions kanaria_core/src/utils/ext.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use UCSChar;
use crate::UCSChar;

pub trait CharExtend {
fn to_char_vec(&self) -> Vec<char>;
Expand All @@ -18,4 +18,4 @@ impl CharExtend for str {
fn to_u32_vec(&self) -> Vec<u32> {
self.chars().map(|c| c as u32).collect()
}
}
}
2 changes: 1 addition & 1 deletion kanaria_core/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub use self::ascii::AsciiUtils;
pub use self::kana::KanaUtils;
pub use self::width::ConvertTarget;
pub use self::width::WidthUtils;
pub use self::ext::CharExtend;
pub use crate::utils::ext::CharExtend;

mod ext;
mod chars;
Expand Down
5 changes: 3 additions & 2 deletions kanaria_core/src/utils/width.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use crate::constants::*;
use crate::UCSChar;

bitflags! {
#[derive(Debug, PartialEq, Copy, Clone)]
pub struct ConvertTarget: u32 {
const NUMBER = CONVERT_TARGET_NUMBER;
const ALPHABET = CONVERT_TARGET_ALPHABET;
const SYMBOL = CONVERT_TARGET_SYMBOL;
const KATAKANA = CONVERT_TARGET_KATAKANA;
const ALL = (Self::NUMBER.bits | Self::ALPHABET.bits | Self::SYMBOL.bits | Self::KATAKANA.bits) as u32;
const ALL = (Self::NUMBER.bits() | Self::ALPHABET.bits() | Self::SYMBOL.bits() | Self::KATAKANA.bits()) as u32;
}
}

Expand Down Expand Up @@ -1678,4 +1679,4 @@ impl WidthUtils {

return (T::from_scalar(result), is_pad);
}
}
}
4 changes: 2 additions & 2 deletions kanaria_extern/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
name = "kanaria_extern"
version = "0.1.0"
authors = ["osamu <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
kanaria = { path = "../kanaria_core" }

[lib]
name = "kanaria"
path = "src/lib.rs"
crate-type = ["cdylib"]
crate-type = ["cdylib"]
4 changes: 2 additions & 2 deletions kanaria_jvm/src/main/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "kanaria_jni"
version = "0.1.0"
authors = ["osamu <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
kanaria = { path = "../../../../kanaria_core" }
Expand All @@ -11,4 +11,4 @@ jni = "0.14.0"
[lib]
name = "kanaria_jni"
path = "src/lib.rs"
crate-type = ["cdylib"]
crate-type = ["cdylib"]

0 comments on commit 3693202

Please sign in to comment.