/**
 * Copyright(c) Live2D Inc. All rights reserved.
 *
 * Use of this source code is governed by the Live2D Open Software license
 * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
 */ import { csmString } from '../type/csmstring' ; import { csmVector } from '../type/csmvector' ; import { CubismId } from './cubismid' ; /**
 * ID名の管理
 *
 * ID名を管理する。
 */ export class CubismIdManager { /**
     * コンストラクタ
     */ public constructor ( ) { this . _ids = new csmVector < CubismId > ( ) ; } /**
     * デストラクタ相当の処理
     */ public release ( ) { for ( let i = 0 ; i < this . _ids . getSize ( ) ; ++ i ) { this . _ids . set ( i , void 0 ) ; } this . _ids = null ; } param ids param count public registerIds ( ids ) { for ( let i = 0 ; i < ids . length ; i ++ ) { this . registerId ( ids [ i ] ) ; } } param id public registerId ( id ) { let result = null ; if ( 'string' == typeof id ) { if ( ( result = this . findId ( id ) ) != null ) { return result ; } result = new CubismId ( id ) ; this . _ids . pushBack ( result ) ; } else { return this . registerId ( id . s ) ; } return result ; } param id public getId ( id ) { return this . registerId ( id ) ; } return return public isExist ( id ) { if ( 'string' == typeof id ) { return this . findId ( id ) != null ; } return this . isExist ( id . s ) ; } param id return private findId ( id ) { for ( let i = 0 ; i < this . _ids . getSize ( ) ; ++ i ) { if ( this . _ids . at ( i ) . getString ( ) . isEqual ( id ) ) { return this . _ids . at ( i ) ; } } return null ; } private _ids : csmVector < CubismId > ; } import * as $ from './cubismidmanager' ; export namespace Live2DCubismFramework { export const CubismIdManager = $ . CubismIdManager ; export type CubismIdManager = $ . CubismIdManager ; }